1 | lib 1008485 // stanford parser |
2 | lib 1008490 // german model |
3 | |
4 | import edu.stanford.nlp.ling.CoreLabel; |
5 | import edu.stanford.nlp.process.TokenizerFactory; |
6 | import edu.stanford.nlp.parser.lexparser.LexicalizedParser; |
7 | import edu.stanford.nlp.process.CoreLabelTokenFactory; |
8 | import edu.stanford.nlp.process.PTBTokenizer; |
9 | import edu.stanford.nlp.process.Tokenizer; |
10 | import edu.stanford.nlp.trees.Tree; |
11 | |
12 | static TokenizerFactory<CoreLabel> stanfordParseGerman_tokenizerFactory; |
13 | static LexicalizedParser stanfordParseGerman_parser; |
14 | sS stanfordParseGerman_PCG_MODEL = "edu/stanford/nlp/models/lexparser/germanPCFG.ser.gz"; |
15 | |
16 | static Tree stanfordParseGerman(S s) { |
17 | synchronized(stanfordParseGerman_PCG_MODEL) { |
18 | if (stanfordParseGerman_tokenizerFactory == null) { |
19 | stanfordParseGerman_tokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), "invertible=true"); |
20 | stanfordParseGerman_parser = LexicalizedParser.loadModel(stanfordParseGerman_PCG_MODEL); |
21 | } |
22 | } |
23 | ret stanfordParseGerman_parser.apply( |
24 | stanfordParseGerman_tokenizerFactory.getTokenizer(new StringReader(s)).tokenize()); |
25 | } |
Began life as a copy of #1008491
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008494 |
Snippet name: | stanfordParseGerman |
Eternal ID of this version: | #1008494/1 |
Text MD5: | 27287bd3401493b41ad9c5ccd335ab5b |
Author: | stefan |
Category: | javax / a.i. parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-05-19 14:17:37 |
Source code size: | 1124 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 465 / 490 |
Referenced in: | [show references] |