Main Content

removeShortWords

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

설명

예제

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

예제

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

예제

모두 축소

문서에서 2자 이하로 이루어진 단어를 제거합니다.

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

   3 tokens: example short sentence

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

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

          Counts: [2x4 double]
      Vocabulary: ["example"    "short"    "sentence"    "second"]
        NumWords: 4
    NumDocuments: 2

입력 인수

모두 축소

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

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

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

출력 인수

모두 축소

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

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

버전 내역

R2017b에 개발됨