Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1008494 // stanfordParseGerman

JavaX fragment (include)

lib 1008485 // stanford parser
lib 1008490 // german 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<CoreLabel> stanfordParseGerman_tokenizerFactory;
static LexicalizedParser stanfordParseGerman_parser;
sS stanfordParseGerman_PCG_MODEL = "edu/stanford/nlp/models/lexparser/germanPCFG.ser.gz";

static Tree stanfordParseGerman(S s) {
  synchronized(stanfordParseGerman_PCG_MODEL) {
    if (stanfordParseGerman_tokenizerFactory == null) {
      stanfordParseGerman_tokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), "invertible=true");
      stanfordParseGerman_parser = LexicalizedParser.loadModel(stanfordParseGerman_PCG_MODEL);
    }
  }
  ret stanfordParseGerman_parser.apply(
    stanfordParseGerman_tokenizerFactory.getTokenizer(new StringReader(s)).tokenize());
}

Author comment

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: 395 / 412
Referenced in: [show references]