java - Adding new option for command line parser: Unrecognised option error -
so i've forked , zipped code github repository contains java files require command line arguments.
here's relevant code problem-
options options = new options(); options.addoption("f", false, "force processing of text file"); options.addoption("printhtml", false, "print html file inspection"); options.addoption("w", true, "coreference weight file"); options.addoption("doc", true, "text document process"); options.addoption("tok", true, "processed text document"); options.addoption("docid", true, "text document id process"); options.addoption("p", true, "output directory"); options.addoption("id", true, "book id"); options.addoption("d", false, "dump pronoun , quotes annotation") commandline cmd = null; try { commandlineparser parser = new basicparser(); cmd = parser.parse(options, args); } catch (exception e) { e.printstacktrace(); }
to added option 'quoteattr' per own requirements
options options = new options(); options.addoption("f", false, "force processing of text file"); options.addoption("printhtml", false, "print html file inspection"); options.addoption("quoteattr", false, "print quote ids , attributions");//here options.addoption("w", true, "coreference weight file"); options.addoption("doc", true, "text document process"); options.addoption("tok", true, "processed text document"); options.addoption("docid", true, "text document id process"); options.addoption("p", true, "output directory"); options.addoption("id", true, "book id"); options.addoption("d", false, "dump pronoun , quotes annotation"); commandline cmd = null; try { commandlineparser parser = new basicparser(); cmd = parser.parse(options, args); } catch (exception e) { e.printstacktrace(); }
adding option code in nothing regular functioning of program.
as shown here -
./runjava novels/booknlp -doc data/originaltexts/dickens.oliver.pg730.txt -printhtml -p data/output/dickens -tok data/tokens/dickens.oliver.tokens -f adding annotator tokenize adding annotator ssplit adding annotator pos reading pos tagger model edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1.6 sec]. adding annotator lemma adding annotator ner loading classifier edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [4.6 sec]. loading classifier edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ...
however when use 'quoteattr' option on command line -
./runjava novels/booknlp -doc data/originaltexts/dickens.oliver.pg730.txt -printhtml -quoteattr -p data/output/dickens -tok data/tokens/dickens.oliver.tokens -f
i error -
org.apache.commons.cli.unrecognizedoptionexception: unrecognized option: -quoteattr @ org.apache.commons.cli.parser.processoption(parser.java:363) @ org.apache.commons.cli.parser.parse(parser.java:199) @ org.apache.commons.cli.parser.parse(parser.java:85) @ novels.booknlp.main(booknlp.java:98) exception in thread "main" java.lang.nullpointerexception @ novels.booknlp.main(booknlp.java:106)
why happening?
Comments
Post a Comment