행렬을 만들려고합니다. 다음은 R 코드Document-Term-Matrix에서`RTextTools :: toLower()`텍스트의 결과를 볼 수 없습니다.
matrix = create_matrix(tweets[,1], toLower = TRUE, language="english",
removeStopwords=FALSE, removeNumbers=TRUE,
stemWords=TRUE)
: 나는 매트릭스의 대문자와 단어가 발언
library(RTextTools)
library(e1071)
pos_tweets = rbind(
c('j AIME la voiture', 'positive'),
c('cette machine est performante', 'positive'),
c('je me sens en bonne forme ce matin', 'positive'),
c('je suis super excitée d aller voir le spectacle de demain', 'positive'),
c('il est mon meilleur ami', 'positive')
)
neg_tweets = rbind(
c('je séteste cette voiture', 'negative'),
c('ce film est horrible', 'negative'),
c('je suis fatiguée ce matin', 'negative'),
c('je déteste ce concert', 'negative'),
c('il n est pas mon ami', 'negative')
)
test_tweets = rbind(
c('je suis heureuse ce matin', 'negative'),
c('un bon ami', 'negative'),
c('je me sens triste', 'positive'),
c('pas belle cette maison', 'negative'),
c('mauvaise chanson', 'negative')
)
tweets = rbind(pos_tweets, neg_tweets, test_tweets)
# build dtm
matrix= create_matrix(tweets[,1], toLower = TRUE, language="french",
removeStopwords=FALSE, removeNumbers=TRUE,
stemWords=TRUE)
문제 이 들어 나는이 R 명령어를 사용합니다.
왜이 문제가 발생하는지 제발 설명해 주시겠습니까? @chateaur 말했듯이
는 당신에게 임의의 지점에서 파이프 라인의 내용을 노출하지 않습니다, 그것은 내부적으로 tolower를 수행하지, 당신
경우 매트릭스에 대문자가 보이십니까? 필자는 create_matrix 함수의 toLower 매개 변수가 데이터를 소문자로 취급하도록 함수에 알리는 것이지만 실제로는 데이터 자체를 수정하지 않는다고 생각합니다. – chateaur
사실, 매트릭스를 살펴보면, 문서는 원본 형태 ('matrix $ dimnames $ Docs'와 같이)로 표시되고, 용어는 소문자로 표시됩니다 ('matrix $ dimnames $ Terms' 참조). 내부적으로 모든 것이 잘 작동하는 것처럼 보입니다. _aime_은 _j AIME la voiture_에서 한 번 발견됩니다. – Scarabee