Main Content

removeLongWords

문서 또는 bag-of-words 모델에서 긴 단어 제거

설명

예제

newDocuments = removeLongWords(documents,len)documents에서 길이가 len 이상인 단어를 제거합니다.

예제

newBag = removeLongWords(bag,len)bagOfWords 객체 bag에서 길이가 len 이상인 단어를 제거합니다.

예제

모두 축소

문서에서 7자 이상으로 이루어진 단어를 제거합니다.

document = tokenizedDocument("An example of a short sentence");
newDocument = removeLongWords(document,7)
newDocument = 
  tokenizedDocument:

   4 tokens: An of a short

bag-of-words 모델에서 7자 이상으로 이루어진 단어를 제거합니다.

documents = tokenizedDocument([ ...
    "an example of a short sentence"
    "a second short sentence"]);
bag = bagOfWords(documents);
newBag = removeLongWords(bag,7)
newBag = 
  bagOfWords with properties:

          Counts: [2x5 double]
      Vocabulary: ["an"    "of"    "a"    "short"    "second"]
        NumWords: 5
    NumDocuments: 2

입력 인수

모두 축소

입력 문서로, tokenizedDocument 배열로 지정됩니다.

입력 bag-of-words 모델로, bagOfWords 객체로 지정됩니다.

제거할 단어의 최소 길이로, 양의 정수로 지정됩니다. 이 함수는 문자 개수가 len 이상인 단어를 제거합니다.

출력 인수

모두 축소

출력 문서로, tokenizedDocument 배열로 반환됩니다.

출력 bag-of-words 모델로, bagOfWords 객체로 반환됩니다.

버전 내역

R2017b에 개발됨