我想使用--use-ngrams true选项运行mallet,但似乎无法使其正常工作。我使用以下命令导入了我的数据:
./bin/mallet import-dir --input path --output topic-input.mallet --keep-seqence -- removed stopwords现在我想训练一个主题ngram模型:
bin/mallet train-topics --input topic-input.mallet --use-ngrams true --num-topics 30 --xml-topic-report topic-report.xml但是我得到了这个错误:
Exception in thread "main" java.lang.ClassCastException: cc.mallet.types.FeatureSequence cannot be cast to cc.mallet.types.FeatureSequenceWithBigrams
at cc.mallet.topics.TopicalNGrams.estimate(TopicalNGrams.java:78)
at cc.mallet.topics.tui.Vectors2Topics.main(Vectors2Topics.java:249)正如您所看到的,我将mallet作为命令行工具运行,而不是深入了解它的API以使其正常工作。有什么建议吗?
发布于 2012-03-29 03:48:43
找到了答案:
您必须使用‘--keep-sequence-bgiram’参数导入要运行topical-ngram建模的目录(例如
./bin/mallet import-dir --input path --output topic-input.mallet --keep-sequence-bigrams --remove-stopwords然后,按如下方式运行主题模型:
bin/mallet train-topics --input topic-input.mallet --use-ngrams true --num-topics 30 --xml-topic-report topic-report.xmlhttps://stackoverflow.com/questions/9892497
复制相似问题