Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple JAPE grammar from GATE tutorial website is not working

Tags:

grammar

gate

I am learning GATE and JAPE grammar along with it. This is the first time I am using GATE and JAPE grammar. I am following this tutorial where grammar to identify something about sports is given. I used this .jape file and sample text given but GATE is not able to identify anything other than Person, Organization, Date, etc.

I would like to know how to use custom .jape grammar in GATE? If someone can please give steps then it will be really great.

Currently I am doing following steps :

  1. Start GATE GUI.

  2. Load ANNIE System with Defaults.

  3. Step (2) loads ANNIE POS Tagger, tokenizer, sentence splitter, etc. under Processing Resources.

  4. Right click on Processing Resources and choose New -> JAPE Transducer.

  5. Give path to .jape file and give some name.

  6. Right click on Language Resources and choose New -> GATE Corpus. Give name to corpus.

  7. Right click on newly created corpus and choose Populate.

  8. Select directory in which text files are present. We want to run GATE on these files.

  9. Double click on ANNIE under Applications node and click on Run This Application button.

Once I click on Run This Application button, and all the processing is complete I open input text file.

This file does not have any tag written in .jape file, it just shows normal tags like Person, Organization, etc.

enter image description here

My .jape file looks as below :

Phase:firstpass
Input:  Lookup  
Options: control = brill

Rule: SportsCategory
Priority: 20
(
{Lookup.majorType == "Sports"}
): label
-->
:label.Sport = {rule= "SportsCategory" } 

and input text file is as follows :

Soccer   -  Rooney  Gerrard   -  File .
Composite  file  picture  of  Liverpool 's  Steven  Gerrard   (left ,  dated  27  September  2006 )  and  Manchester  United 's  Wayne  Rooney   (dated  20  August  2006 ) .  On  the  occasion  of  his  21st  Birthday ,  Tuesday  24  October  2006 ,  Wayne  Rooney  has  hailed  England  team -mate  Steven  Gerrard  as  one  of  the  world 's  best  midfielders  and  wishes  the  Liverpool  star  could  play  at  Manchester  United .  

Can anyone please tell me if I am missing any other step. I am not able to find step by step instructions for this :( I wish if GATE people would have spent some time in writing such a tutorial.

like image 260
Shekhar Avatar asked Oct 02 '22 19:10

Shekhar


1 Answers

Your rule is not fired because there are no lookups with major type Sports in the annotated document.

Unless you added something to the default ANNIE application, I just opened it and saw that in the default gazetteer there's only one file with majorType sport and it contains things like tennis, swimming, etc. no soccer. If you're using a rule-based system you'll probably end up adding lots of dictionaries as well :)

A good practice is to create a simple test document and run you pipeline up to the jape rule (stop or exclude all PRs after that), then check in the document if the LHS prerequisites are met. In your case there should be a Lookup with majorType sports.

I think the best jape step by step tutorial can be found in this training material. But you figured it out.

like image 157
Yasen Avatar answered Oct 07 '22 19:10

Yasen