У меня есть несколько TermDocumentMatrix
, созданных с пакетом tm
в R.
Я хочу найти 10 наиболее часто встречающихся терминов в каждом наборе документов, чтобы в итоге получить таблицу вывода, например:
corpus1 corpus2
"beach" "city"
"sand" "sidewalk"
... ...
[10th most frequent word]
По определению findFreqTerms(corpus1,N)
возвращает все члены, которые появляются N раз или больше. Чтобы сделать это вручную, я мог изменить N, пока не получил 10 или около того терминов, но результат для findFreqTerms
указан в алфавитном порядке, поэтому, если я не выбрал именно правильный N, я бы не знал, какие из них были топ-10. я что это связано с манипулированием внутренней структурой TDM, которую вы можете видеть с помощью str(corpus1)
, как в R tm package создать матрицу из самых частых терминов, но ответ здесь был очень непрозрачный для меня, поэтому я хотел перефразировать вопрос.
Спасибо!