0

Exception while executing Train the model. Please find the steps that I have followed to train NER model,

Step1 : Create the training file like,

the 0
Greenland   LOC
whale   0
is  0
deposed 0
,   0
-   0
the 0
great   0
sperm   0
whale   0
now 0
reigneth    0
!   0

and save as "TrainingFile.tsv" file.

Step2: Created a .prop file we could use to train the first classifier.

Custom-ner.prop:

trainFile = TrainingFile.tsv
serializeTo = ner-model.ser.gz
map = word=0,answer=1
maxLeft=1
useClassFeature=true
useWord=true
useNGrams=true
noMidNGrams=true
maxNGramLeng=6
usePrev=true
useNext=true
useDisjunctive=true
useSequences=true
usePrevSequences=true
useTypeSeqs=true
useTypeSeqs2=true
useTypeySequences=true
wordShape=chris2useLC

Step3: Build the classifier by executing the below code,

java -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier \
-prop propforclassifierone.prop

While perform the Step3 throws an exception like,

Exception :

useSequences=true
wordShape=chris2useLC
useTypeySequences=true
useDisjunctive=true
noMidNGrams=true
serializeTo=ner-model.ser.gz
maxNGramLeng=6
useNGrams=true
usePrev=true
useNext=true
maxLeft=1
trainFile=directories2-10combined.tsv
map=word=0,answer=1
useWord=true
useTypeSeqs=true
=\
Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: java.io.FileN
otFoundException: directories2-10combined.tsv (The system cannot find the file s
pecified)
        at edu.stanford.nlp.io.IOUtils.inputStreamFromFile(IOUtils.java:509)
        at edu.stanford.nlp.io.IOUtils.readerFromFile(IOUtils.java:550)
        at edu.stanford.nlp.objectbank.ReaderIteratorFactory$ReaderIterator.setN
extObject(ReaderIteratorFactory.java:189)
        at edu.stanford.nlp.objectbank.ReaderIteratorFactory$ReaderIterator.<ini
t>(ReaderIteratorFactory.java:161)
        at edu.stanford.nlp.objectbank.ResettableReaderIteratorFactory.iterator(
ResettableReaderIteratorFactory.java:98)
        at edu.stanford.nlp.objectbank.ObjectBank$OBIterator.<init>(ObjectBank.j
ava:414)
        at edu.stanford.nlp.objectbank.ObjectBank.iterator(ObjectBank.java:253)
        at edu.stanford.nlp.sequences.ObjectBankWrapper.iterator(ObjectBankWrapp
er.java:45)
        at edu.stanford.nlp.ie.crf.CRFClassifier.train(CRFClassifier.java:1585)
        at edu.stanford.nlp.ie.AbstractSequenceClassifier.train(AbstractSequence
Classifier.java:758)
        at edu.stanford.nlp.ie.AbstractSequenceClassifier.train(AbstractSequence
Classifier.java:746)
        at edu.stanford.nlp.ie.crf.CRFClassifier.main(CRFClassifier.java:3034)
Caused by: java.io.FileNotFoundException: directories2-10combined.tsv (The syste
m cannot find the file specified)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at edu.stanford.nlp.io.IOUtils.inputStreamFromFile(IOUtils.java:503)
        ... 11 more

1 Answer 1

0

Are you sure, you are using the correct files?

In your example in Step 2 you have a properties file called Custom-ner.prop, while in Step 3 you call a command with a file called propforclassifierone.prop. Also, your training file seems to be named differently: TrainingFile.tsv vs. directories2-10combined.tsv.

Plus, make sure, your training file is in your class path (respective in the same directory as the jar file) or provide the absolute path of your training file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.