Main Content

splitSentences

텍스트를 문장으로 분할

설명

예제

newStr = splitSentences(str)str을 문장으로 구성된 배열로 분할합니다.

newDocuments = splitSentences(document)는 단일 tokenizedDocument 객체를 문장으로 구성된 tokenizedDocument 배열로 분할합니다.

예제

모두 축소

예제 파일 sonnets.txt에서 텍스트를 읽어온 다음 문장으로 분할합니다.

filename = "sonnets.txt";
str = extractFileText(filename);
sentences = splitSentences(str);

처음 몇 개의 문장을 표시합니다.

sentences(1:10)
ans = 10x1 string
    "THE SONNETS"
    "by William Shakespeare"
    "I"
    "From fairest creatures we desire increase,..."
    "II"
    "When forty winters shall besiege thy brow,..."
    "How much more praise deserv'd thy beauty's use,..."
    "This were to be new made when thou art old,..."
    "III"
    "Look in thy glass and tell the face thou viewest..."

입력 인수

모두 축소

입력 텍스트로, string형 스칼라, 문자형 벡터 또는 문자형 벡터를 포함하는 스칼라 셀형 배열로 지정됩니다.

데이터형: string | char | cell

입력 문서로, 스칼라 tokenizedDocument 객체로 지정됩니다.

출력 인수

모두 축소

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

str이 string형이면 newStr도 string형입니다. 그렇지 않으면, newStr은 문자형 벡터로 구성된 셀형 배열입니다.

데이터형: string | cell

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

알고리즘

이모티콘이나 이모지 문자가 종결 문장 부호 문자 뒤에 나오면, 이 함수는 이모티콘과 이모지 다음에서 문장을 분할합니다.

버전 내역

R2018a에 개발됨