수집 한 많은 짹짹의 쌍 주파수를 계산하고 싶습니다. 그래서 Gephi (네트워크 그래프)에서 시각화에 사용할 수 있습니다. 현재 데이터는 다음과 같습니다 (문자 임). 이 샘플 데이터 세트 큰 문자를 Gephi의 단어 빈도 행렬로 변환하십시오.
str(Tweet_text)
chr [1:8661] "habits that separates successful persons from mediocre persons habit success startup entrepreneurship" ...
, 난 8661 트위터가 다음과 같이
head(Tweet_text)
[1] "habits that separates successful persons from mediocre persons habit success startup entrepreneurship"
[2] "business entrepreneurship tech watch youtube star casey neistat ride a drone dressed as santa"
[3] "how to beat procrastination work deadlines workculture productivity management hr hrd entrepreneurship"
[4] "reading on entrepreneurship and startups and enjoying my latte"
[5] "not a very nice way to encourage entrepreneurship and in the same sentence dog another company"
[6] "us robotics founder on earlyday internet entrepreneurship articles management"
구조이다. 이제 저는 Gephi로 내보낼 수있는이 트윗 전체에 대해 pairwise 단어 빈도를 계산하려고합니다.
+------------------------+--------------+------+
| term1 | term 2 | Freq |
+------------------------+--------------+------+
| entrepreneurship | startup | 2 |
+------------------------+--------------+------+
그래서 나는 TM 패키지의 DocumentTermMatrix 기능을 사용하기 시작 : 내가 찾고 있어요 최종 결과는 다음과 같다
dtm <- DocumentTermMatrix(Corpus(VectorSource(Tweet_text)))
이 근무 ("성공"에서의 주파수 아래 참조 제 트윗)
,691이 후inspect(dtm[1, c("success")])
<<DocumentTermMatrix (documents: 1, terms: 1)>>
Non-/sparse entries: 1/0
Sparsity : 0%
Maximal term length: 7
Weighting : term frequency (tf)
Terms
Docs success
1 1
난으로 원하는 테이블 형식이 주파수 으려고
m<-as.matrix(dtm)
m[m>=1] <- 1
m <- m %*% t(m)
Dat_Freq <- as.data.frame(as.table(m))
그러나 이제 첫 번째 문제가 시작되고 행렬이 너무 커집니다. 그 다음으로는 pairwise-wordfrequencies를 특정 값으로 제한 할 수있는 방법을 모르겠습니다. 시험의 경우, 한 쌍의 주파수가 10보다 커야 매트릭스가 커지지 않습니다.
이러한 pairwise-frequency를 csv 형식으로 얻는 방법에 대해 조언 해 주시면 감사하겠습니다.
모든 최고의 :
감사합니다 Yannis P.! 나는 전에이 책을 몰랐으므로 확실히 확인해 볼 것입니다. 솔루션을 찾은 경우 댓글을 남깁니다. :) 네, 맞습니다. 먼저 불쾌감을 제거해야합니다. –
확인하는 데 시간이 걸렸으며 tidytext 라이브러리가 pairwise 단어 주파수에 완벽하게 작동합니다! 감사합니다 Yannis! –
텍스트 처리를위한 새로운 'go-to'인 것으로 보입니다. R –