Hello,
in OpenNLP we just provide the core components, but do not offer any
workflow support,
usually people put the components together in their code or use tool
which can do it for them
e.g. UIMA.
The name finder returns a set of Span objects, these can be inserted
into a parse tree
via the Parse.addNames method.
In your code sample below you would create a loop which reads in sentences,
for each sentence you need to do parsing and named entity detection,
after the entity
detection you can insert the names via the addNames method into the
parse object.
I am not sure, but the addNames method might be only in trunk (or later
in the 1.5.3 release).
Jörn
On 12/13/2012 06:19 AM, Ant B wrote:
Hi Jörn,
Thank you for the very quick reply, and for the advice to examine the TreebankNameFinder
class from trunk (I noticed the comment that "@deprecated will be removed soon"
which is good news!).
The TreebankNameFinder class seems more an executable tool, rather than an API
tool.
Ideally, I would like to pass a Parse object (for a sentence) and
TokenNameFinderModel object to a method in TreebankNameFinder - from within a
Java class method - and receive a Parse object with NER annotations added. For
example:
// start dummy snippet
TokenNameFinderModel someNFModel = new TokenNameFinderModel(
modelInputStream );
Parse sentenceParse = this.magicMethodToCreateSentenceParse();
/*
* Here's the functionality I would like in an ideal world…
*/
TreebankNameFinder tbNameFinder = new TreebankNameFinder( someNFModel );
Parse newSentenceParseWithNERs = tbNameFinder.processParse(
someSentenceParse );
// end of snippet
The methods in TreebankNameFinder are private, and none have this signature…
Would it be possible to include such functionality?
I am going experiment with the code - I can keep you informed of progress if
you like?
I look forward to the 1.5.3 release - I appreciate all the hard work.
Cheers,
Ant
On Dec 12, 2012, at 9:34 AM, Jörn Kottmann <[email protected]> wrote:
On 12/12/2012 01:44 AM, Ant B wrote:
I would really appreciate any advice on how to add NER annotation of
sentence Parse objects to support use of the coreference tool (version
1.5.2-incubating).
The tool to insert the named entites into the parse tree was removed at some
point by accident.
It is restored in trunk. I suggest to try out the trunk version which will
released soon as 1.5.3 more
or less like it is right now.
The TreebankNameFinder takes the parse tree and ner models as input and outputs
the parse tree with
the names. This can then be passed as input to the coreference component.
Jörn