【问题标题】:Mallet: Topical N-gramsMallet:局部 N-gram
【发布时间】:2012-04-11 03:49:03
【问题描述】:

我想使用 --use-ngrams true 选项运行槌,但似乎无法使其正常工作。我已使用以下方式导入数据:

./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 以使其正常工作。有什么建议吗?

【问题讨论】:

    标签: java mallet lda topic-modeling


    【解决方案1】:

    找到答案:

    您必须使用“--keep-sequence-bgirams”参数导入您想要运行 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.xml
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-06
      • 2011-06-30
      • 2016-08-01
      • 2018-04-05
      • 2011-11-27
      • 1970-01-01
      • 1970-01-01
      • 2018-08-12
      相关资源
      最近更新 更多