nlp - Embedding jape rules in java (Gate) -


i trying write own rule annotates author (from author,jape) in java code have initialized new processing resource.the code runs fine not annotates ma text: input: author of xyz output: should annotated author , shd save name of book in temporary variable. java code:

    gate.init(); gate.getcreoleregister().registerdirectories(            new file(gate.getpluginshome(), "annie").touri().tourl()); serialanalysercontroller pipeline =           (serialanalysercontroller)gate.factory.createresource(              "gate.creole.serialanalysercontroller"); languageanalyser tokeniser = (languageanalyser)gate.factory.createresource(              "gate.creole.tokeniser.defaulttokeniser"); languageanalyser jape = (languageanalyser)gate.factory.createresource(           "gate.creole.transducer", gate.utils.featuremap(               "grammarurl", new file("e:\\gate_developer_7.1\\plugins\\annie\\resources\\ne\\author.jape").touri().tourl(),               "encoding", "utf-8")); pipeline.add(tokeniser); pipeline.add(jape); corpus corpus = gate.factory.newcorpus(null); document doc = gate.factory.newdocument("who author of inception"); documentcontent dc=doc.getcontent();         corpus.add(doc); pipeline.setcorpus(corpus); pipeline.execute(); system.out.println("found annotations of following types: " +           doc.getannotations().getalltypes()); 

in output gives token,space token can me workout problem.?

problem in jape grammar, not in java code. java code works fine following jape grammar:

phase: test1 input: token options: control = appelt rule: testrule ( {token.kind == "word"} {token.kind == "word"}):annotate --> :annotate.twowords = { string = :annotate.token.string }

output is:

found annotations of following types: [spacetoken, twowords, token]

i more problem if provide jape grammar.

alternatively can play jape grammar in gate developer until start match want. after java program work fine.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -