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

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

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。

# 训练数据的位置
trainFileList = /path/to/conll.3class.train
# 测试数据的位置
testFile = /path/to/all.3class.test
# 保存模型的位置
serializeTo = ner.model.ser.gz

type = crf

wordFunction = edu.stanford.nlp.process.AmericanizeFunction

useDistSim = false

# 确定数据文件格式
map = word=0,answer=1

saveFeatureIndexToDisk = true

useClassFeature=true
useWord=true
useNGrams=true
noMidNGrams=true
maxNGramLeng=6
usePrev=true
useNext=true
useLongSequences=true
useSequences=true
usePrevSequences=true
maxLeft=1
useTypeSeqs=true
useTypeSeqs2=true
useTypeySequences=true
useOccurrencePatterns=true
useLastRealWord=true
useNextRealWord=true
normalize=true
wordShape=chris2useLC
useDisjunctive=true
disjunctionWidth=5

readerAndWriter=edu.stanford.nlp.sequences.ColumnDocumentReaderAndWriter

useObservedSequencesOnly=true

useQN = true
QNsize = 25

# 提高运行速度
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.

# location of training data
trainFileList = /path/to/conll.3class.train
# location of test data
testFile = /path/to/all.3class.test
# where to store the saved model
serializeTo = ner.model.ser.gz

type = crf

wordFunction = edu.stanford.nlp.process.AmericanizeFunction

useDistSim = false

# establish the data file format
map = word=0,answer=1

saveFeatureIndexToDisk = true

useClassFeature=true
useWord=true
useNGrams=true
noMidNGrams=true
maxNGramLeng=6
usePrev=true
useNext=true
useLongSequences=true
useSequences=true
usePrevSequences=true
maxLeft=1
useTypeSeqs=true
useTypeSeqs2=true
useTypeySequences=true
useOccurrencePatterns=true
useLastRealWord=true
useNextRealWord=true
normalize=true
wordShape=chris2useLC
useDisjunctive=true
disjunctionWidth=5

readerAndWriter=edu.stanford.nlp.sequences.ColumnDocumentReaderAndWriter

useObservedSequencesOnly=true

useQN = true
QNsize = 25

# makes it go faster
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:

确定