View Source

The IE pipeline creates annotations. The gazetteer creates Lookup annotations, but there are also other temporary annotations which only role is to help other processing resources and rules to create meaningful annotations at the end. KIM has a white-list with all these meaningful annotation types in the property *IE_ANN_TYPES* in {{KIM/config/nerc.properties}}. At the end of the processing of a document, all annotations not in this list are removed.

Now the task is to transform all Lookups from the {{Person}} annotation set into {{Person}} annotations in the default annotation set. The easiest way is with a jape rule. The Jape rule looks like this:

{noformat}
Phase: dbpedia_person
Input: Person
Options: control = all
{noformat}
\\
{noformat}
Rule:dbpedia_person
(\{Lookup\}):match
-->
:match.Person = \{ class = :match.Lookup.class , inst = :match.Lookup.inst, rule=dbpedia_person \}
{noformat}

!worddavd31bee101649f6e4251feaa6e05c966f.png|height=11,width=18! The rule does not transform the existing Lookup annotations. It creates new {{Person}} annotations over the same phrases as the lookups.

Put this grammar in a file called {{dbpedia_person.jape}} and store it in
{{KIM/context/default/resources/grammar/dbpedia}}. Then create a Jape transducer processing resource for this grammar in the GATE UI and place it after the new gazetteer in the pipeline. The important thing here is to set the *inputASName* parameter to the new annotation set ({{Person}}) and leave the *outputASName* parameter empty. This will make the rule match annotations from the {{Person}} annotation set and create annotations in the default annotation set.

!worddavf1ec2357062a149985fa2bcf179361d8.png|height=530,width=655!
*The Jape transducer processing resource in the GATE UI*

Run the pipeline over your test document and see how it will create new annotations of type {{Person}} in the default annotation set.

Store the changes you made in GATE, so that KIM will be able to use them later. You can do this by right clicking on the pipeline and choosing {{"Save Application State"}}. Then save it over the application descriptor file KIM uses, which in this case is {{KIM/context/default/resources/IE.gapp}}. The exact path is set in the {{IE_APP}} property in {{KIM/config/nerc.properties}}.