Main Content

wordCloudCounts

워드 클라우드 생성을 위한 단어 개수 계산

설명

예제

T = wordCloudCounts(str)은 워드 클라우드 생성을 위해 str의 텍스트를 토큰화하고 전처리한 후 단어와 빈도 수로 구성된 테이블 T를 반환합니다. 이 함수는 한국어, 영어, 일본어, 독일어 텍스트를 지원합니다.

예제

모두 축소

extractFileText를 사용하여 sonnets.txt에서 텍스트를 추출합니다.

str = extractFileText("sonnets.txt");

첫 번째 소네트를 표시합니다.

i = strfind(str,"I");
ii = strfind(str,"II");
start = i(1);
fin = ii(1);
extractBetween(str,start,fin-1)
ans = 
    "I
     
       From fairest creatures we desire increase,
       That thereby beauty's rose might never die,
       But as the riper should by time decease,
       His tender heir might bear his memory:
       But thou, contracted to thine own bright eyes,
       Feed'st thy light's flame with self-substantial fuel,
       Making a famine where abundance lies,
       Thy self thy foe, to thy sweet self too cruel:
       Thou that art now the world's fresh ornament,
       And only herald to the gaudy spring,
       Within thine own bud buriest thy content,
       And tender churl mak'st waste in niggarding:
         Pity the world, or else this glutton be,
         To eat the world's due, by the grave and thee.
     
       "

소네트 텍스트를 토큰화하고 전처리한 후 단어 빈도 수로 구성된 테이블을 만듭니다.

T = wordCloudCounts(str);
head(T)
     Word     Count
    ______    _____

    "thy"      281 
    "thou"     235 
    "love"     188 
    "thee"     162 
    "eyes"      90 
    "doth"      88 
    "make"      63 
    "mine"      63 

입력 인수

모두 축소

입력 텍스트로, string형 배열, 문자형 벡터 또는 문자형 벡터로 구성된 셀형 배열로 지정됩니다.

string형 입력값의 경우 wordcloud 함수와 wordCloudCounts 함수는 한국어, 영어, 일본어, 독일어의 토큰화를 사용하고, 불용어 제거 및 단어 정규화를 합니다.

예: ["an example of a short document";"a second short document"]

데이터형: string | char | cell

출력 인수

모두 축소

중요도를 기준으로 정렬된 단어 개수 테이블. 테이블의 열은 다음과 같이 구성됩니다.

Word단어의 string형 스칼라.
Count문서에서 단어가 나오는 횟수. 이 함수는 대/소문자만 다르거나 normalizeWords에 따라 공통된 어간을 갖는 단어의 개수를 그룹화합니다. 예를 들어 이 함수는 "walk", "Walking", "walking", "walks"의 개수를 그룹화합니다.

세부 정보

모두 축소

언어 고려 사항

string형 입력값의 경우 wordcloud 함수와 wordCloudCounts 함수는 한국어, 영어, 일본어, 독일어의 토큰화를 사용하고, 불용어 제거 및 단어 정규화를 합니다.

버전 내역

R2017b에 개발됨