List of usage examples for edu.stanford.nlp.parser.lexparser LexicalizedParser getOp
@Override
public Options getOp()
From source file:gov.llnl.ontology.text.parse.StanfordParser.java
License:Open Source License
/** * Creates a new {@link StanfordParser} using the provided model location. * If {@code loadFromJar} is {@code true}, then the path is assumed to refer * to a file within the currently running jar. This {@link Parser} can * readily by used within a map reduce job by setting {@code loadFromJar} to * true and including the parser model within the map reduce jar. *///from w w w . ja v a 2s. com public StanfordParser(String parserModel, boolean loadFromJar) { LexicalizedParser p = null; GrammaticalStructureFactory g = null; try { InputStream inStream = (loadFromJar) ? StreamUtil.fromJar(this.getClass(), parserModel) : new FileInputStream(parserModel); p = new LexicalizedParser(new ObjectInputStream(StreamUtil.gzipInputStream(inStream))); g = p.getOp().tlpParams.treebankLanguagePack().grammaticalStructureFactory(); } catch (Exception e) { throw new RuntimeException(e); } parser = p; gsf = g; }