|
From: Shekhar P. <She...@ma...> - 2010-11-24 15:50:02
|
<FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size=2>Hi,<br>Try this (assumes that on the LHS of the JAPE rule) you use the label "person" for occurrences of Person:<br>AnnotationSet personSet = (AnnotationSet) bindings.get("person");<br>if (personSet.size() > 3) //more than 3 Person annotations<br>{String personStr;<br>for (Annotation personAnn: AnnotationSet)<br>{<br>try {<br> personStr = doc.getContent().getContent(<br> personAnn.getStartNode().getOffset(),<br> personAnn.lgetEndNode().getOffset()).toString();<br>//Now you can do what you want with personStr<br>}<br>catch (InvalidOffsetException e)<br> {<br> throw new GateRuntimeException(e);<br> }<br>}<br><br>Hope this helps.<br><br>Cheers,<br>Shekhar Pradhan<br><div><br></div><font color="#990099">-----Vuong Dao Nghe <vuo...@ya...> wrote: -----<br><br></font><blockquote style="border-left: 2px solid #000000; padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">To: gat...@li...<br>From: Vuong Dao Nghe <vuo...@ya...><br>Date: 11/22/2010 03:21AM<br>Subject: [gate-users] How to extract the words that annotated<br><br><div style="font-family: arial,helvetica,sans-serif; font-size: 14pt;"><div style="font-family: arial,helvetica,sans-serif; font-size: 14pt;">Hi all,<br><br>I am looking for the answer for this but long time couldn't find the correct way.<br><br>When you run a gate pipeline, then open the document, choose annotation Sets then tick an Annotation, for example Person, you will see all words related Person will be highlighted.<br>How can I print out all these highlighted words ? Now I can write in java to load the pipeline with document and all necessary PRs. But I dont know how is the code to print out the words the be long to Person annotation for example ?<br><br>Can I print the words annotated that appear for more than 3 times ?<br><br>Thomas</div>
</div><br>
<font face="Courier New,Courier,monospace" size="3">------------------------------------------------------------------------------<br>Beautiful is writing same markup. Internet Explorer 9 supports<br>standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.<br>Spend less time writing and rewriting code and more time creating great<br>experiences on the web. Be a part of the beta today<br><a href="http://p.sf.net/sfu/msIE9-sfdev2dev">http://p.sf.net/sfu/msIE9-sfdev2dev</a></font><font face="Courier New,Courier,monospace" size="3">_______________________________________________<br>GATE-users mailing list<br>GAT...@li...<br><a href="https://lists.sourceforge.net/lists/listinfo/gate-users">https://lists.sourceforge.net/lists/listinfo/gate-users</a><br></font>
</blockquote><br></FONT>
|