MATLAB 도움말 센터
토큰화된 문서 배열, bag-of-words 모델 또는 bag-of-n-grams 모델에서 빈 문서 제거
newDocuments = removeEmptyDocuments(documents)
newBag = removeEmptyDocuments(bag)
[___,idx] = removeEmptyDocuments(___)
newDocuments = removeEmptyDocuments(documents)는 documents에서 단어가 없는 문서를 제거합니다.
newDocuments
documents
예제
newBag = removeEmptyDocuments(bag)는 bag-of-words 또는 bag-of-n-grams 모델 bag에서 단어나 n-gram이 없는 문서를 제거합니다.
newBag
bag
[___,idx] = removeEmptyDocuments(___)는 제거된 문서의 인덱스도 반환합니다.
idx
모두 축소
토큰화된 문서로 구성된 배열에서 단어가 없는 문서를 제거합니다.
빈 문서가 포함된 토큰화된 문서로 구성된 배열을 만듭니다.
documents = tokenizedDocument([ "an example of a short sentence" "" "a second short sentence" ""])
documents = 4×1 tokenizedDocument: 6 tokens: an example of a short sentence 0 tokens: 4 tokens: a second short sentence 0 tokens:
빈 문서를 제거합니다.
newDocuments = 2×1 tokenizedDocument: 6 tokens: an example of a short sentence 4 tokens: a second short sentence
bag-of-words 모델에서 단어를 포함하지 않는 문서를 제거합니다.
토큰화된 문서로 구성된 배열에서 bag-of-words 모델을 만듭니다.
documents = tokenizedDocument([ "An example of a short sentence." "" "A second short sentence." ""]); bag = bagOfWords(documents)
bag = bagOfWords with properties: NumWords: 9 Counts: [4×9 double] Vocabulary: ["An" "example" "of" "a" "short" "sentence" "." "A" "second"] NumDocuments: 4
bag-of-words 모델에서 빈 문서를 제거합니다.
newBag = bagOfWords with properties: NumWords: 9 Counts: [2×9 double] Vocabulary: ["An" "example" "of" "a" "short" "sentence" "." "A" "second"] NumDocuments: 2
배열에서 단어가 없는 문서를 제거하고, 제거된 문서의 인덱스를 사용하여 해당 레이블도 제거합니다.
레이블로 구성된 벡터를 만듭니다.
labels = ["T"; "F"; "F"; "T"]
labels = 4×1 string "T" "F" "F" "T"
빈 문서를 제거하고 제거된 문서의 인덱스를 가져옵니다.
[newDocuments, idx] = removeEmptyDocuments(documents)
idx = 2×1 2 4
labels에서 해당 레이블을 제거합니다.
labels
labels(idx) = []
labels = 2×1 string "T" "F"
tokenizedDocument
입력 문서로, tokenizedDocument 배열로 지정됩니다.
bagOfWords
bagOfNgrams
입력 bag-of-words 모델 또는 bag-of-n-grams 모델로, bagOfWords 객체 또는 bagOfNgrams 객체로 지정됩니다.
출력 문서로, tokenizedDocument 배열로 반환됩니다.
출력 모델로, bagOfWords 객체 또는 bagOfNgrams 객체로 반환됩니다. newBag의 유형은 bag의 유형과 같습니다.
제거된 문서의 인덱스로, 양의 정수로 구성된 벡터로 반환됩니다.
R2017b에 개발됨
bagOfWords | bagOfNgrams | addDocument | removeDocument | tokenizedDocument
addDocument
removeDocument
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
유럽
아시아 태평양
지역별 지사에 문의