lib 1008485 // stanford parser lib 1008486 // english model import edu.stanford.nlp.ling.CoreLabel; import edu.stanford.nlp.process.TokenizerFactory; import edu.stanford.nlp.parser.lexparser.LexicalizedParser; import edu.stanford.nlp.process.CoreLabelTokenFactory; import edu.stanford.nlp.process.PTBTokenizer; import edu.stanford.nlp.process.Tokenizer; import edu.stanford.nlp.trees.Tree; static TokenizerFactory stanfordParseEnglish_tokenizerFactory; static LexicalizedParser stanfordParseEnglish_parser; sS stanfordParseEnglish_PCG_MODEL = "edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz"; static Tree stanfordParseEnglish(S s) { synchronized(stanfordParseEnglish_PCG_MODEL) { if (stanfordParseEnglish_tokenizerFactory == null) { stanfordParseEnglish_tokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), "invertible=true"); stanfordParseEnglish_parser = LexicalizedParser.loadModel(stanfordParseEnglish_PCG_MODEL); } } ret stanfordParseEnglish_parser.apply( stanfordParseEnglish_tokenizerFactory.getTokenizer(new StringReader(s)).tokenize()); }