Stanford Core NLP ner 4.0.0错误:找不到或加载主类stanford-ner.jar;lib.*

huangapple 未分类评论45阅读模式
英文:

Stanford Core NLP ner 4.0.0 Error: Could not find or load main class stanford-ner.jar;lib.*

问题

我正在尝试使用Stanford CoreNLP训练一个命名实体识别模型,但它找不到主类。我已经在我的CLASSPATH中添加了到jar文件的路径,但它仍然无法定位它们。有没有办法修复这个问题呢?

英文:

I am trying to train a NER model with Stanford CoreNLP however it cannot find the main class. I have included the paths to the jar files in my CLASSPATH yet it still cannot locate them. Any way to fix this please?

C:\Users\apaul\Desktop\CoreNLP\stanford-corenlp-4.0.0\stanford-ner-4.0.0>java -cp "C:\Users\apaul\Desktop\CoreNLP\stanford-ner-4.0.0*" -mx3g stanford-ner.jar;lib/* edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier classifiers\english.all.3class.distsim.crf.ser.gz -textFile file
Picked up _JAVA_OPTIONS: -Xmx256M
Error: Could not find or load main class stanford-ner.jar;lib.*

答案1

得分: 0

1.) 进入C:\Users\apaul\Desktop\CoreNLP\stanford-corenlp-4.0.0\stanford-ner-4.0.0目录。

2.) 创建一个训练 props 文件并将其放在该目录中。例如,为这个示例命名为 my-model.props。

  1. # 训练数据的位置
  2. trainFileList = /path/to/conll.3class.train
  3. # 测试数据的位置
  4. testFile = /path/to/all.3class.test
  5. # 保存模型的位置
  6. serializeTo = ner.model.ser.gz
  7. type = crf
  8. wordFunction = edu.stanford.nlp.process.AmericanizeFunction
  9. useDistSim = false
  10. # 确定数据文件格式
  11. map = word=0,answer=1
  12. saveFeatureIndexToDisk = true
  13. useClassFeature=true
  14. useWord=true
  15. useNGrams=true
  16. noMidNGrams=true
  17. maxNGramLeng=6
  18. usePrev=true
  19. useNext=true
  20. useLongSequences=true
  21. useSequences=true
  22. usePrevSequences=true
  23. maxLeft=1
  24. useTypeSeqs=true
  25. useTypeSeqs2=true
  26. useTypeySequences=true
  27. useOccurrencePatterns=true
  28. useLastRealWord=true
  29. useNextRealWord=true
  30. normalize=true
  31. wordShape=chris2useLC
  32. useDisjunctive=true
  33. disjunctionWidth=5
  34. readerAndWriter=edu.stanford.nlp.sequences.ColumnDocumentReaderAndWriter
  35. useObservedSequencesOnly=true
  36. useQN = true
  37. QNsize = 25
  38. # 提高运行速度
  39. featureDiffThresh=0.05

3.) 在相同的目录中运行命令java -cp "*" -Xmx3g edu.stanford.nlp.ie.crf.CRFClassifier -prop my-model.props

英文:

1.) cd into C:\Users\apaul\Desktop\CoreNLP\stanford-corenlp-4.0.0\stanford-ner-4.0.0

2.) Create a training props file and put it in that directory. For this example call it my-model.props.

  1. # location of training data
  2. trainFileList = /path/to/conll.3class.train
  3. # location of test data
  4. testFile = /path/to/all.3class.test
  5. # where to store the saved model
  6. serializeTo = ner.model.ser.gz
  7. type = crf
  8. wordFunction = edu.stanford.nlp.process.AmericanizeFunction
  9. useDistSim = false
  10. # establish the data file format
  11. map = word=0,answer=1
  12. saveFeatureIndexToDisk = true
  13. useClassFeature=true
  14. useWord=true
  15. useNGrams=true
  16. noMidNGrams=true
  17. maxNGramLeng=6
  18. usePrev=true
  19. useNext=true
  20. useLongSequences=true
  21. useSequences=true
  22. usePrevSequences=true
  23. maxLeft=1
  24. useTypeSeqs=true
  25. useTypeSeqs2=true
  26. useTypeySequences=true
  27. useOccurrencePatterns=true
  28. useLastRealWord=true
  29. useNextRealWord=true
  30. normalize=true
  31. wordShape=chris2useLC
  32. useDisjunctive=true
  33. disjunctionWidth=5
  34. readerAndWriter=edu.stanford.nlp.sequences.ColumnDocumentReaderAndWriter
  35. useObservedSequencesOnly=true
  36. useQN = true
  37. QNsize = 25
  38. # makes it go faster
  39. featureDiffThresh=0.05

3.) run java -cp "*" -Xmx3g edu.stanford.nlp.ie.crf.CRFClassifier -prop my-model.props in the same directory.

huangapple
  • 本文由 发表于 2020年7月24日 04:54:28
  • 转载请务必保留本文链接:https://java.coder-hub.com/63062982.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定