Revision: 14561
          http://gate.svn.sourceforge.net/gate/?rev=14561&view=rev
Author:   markagreenwood
Date:     2011-11-17 11:09:05 +0000 (Thu, 17 Nov 2011)
Log Message:
-----------
added Adam's JAPE for fixing up the lemma features produced by the TreeTagger

Added Paths:
-----------
    
gate/trunk/plugins/Tagger_Framework/resources/TreeTagger/fix-treetagger-lemma.jape

Added: 
gate/trunk/plugins/Tagger_Framework/resources/TreeTagger/fix-treetagger-lemma.jape
===================================================================
--- 
gate/trunk/plugins/Tagger_Framework/resources/TreeTagger/fix-treetagger-lemma.jape
                          (rev 0)
+++ 
gate/trunk/plugins/Tagger_Framework/resources/TreeTagger/fix-treetagger-lemma.jape
  2011-11-17 11:09:05 UTC (rev 14561)
@@ -0,0 +1,34 @@
+Phase: FixTreeTaggerLemma
+Input: Token
+Options: control = appelt
+
+Rule: Token
+({Token}):token
+-->
+:token {
+  Annotation token = tokenAnnots.iterator().next();
+  FeatureMap fm = token.getFeatures();
+  if (fm.containsKey("lemma")) {
+     String lemma = fm.get("lemma").toString();
+
+     if (lemma.contains("@") || lemma.equals("<unknown>") ) {
+       String string = fm.get("string").toString();
+       fm.put("lemma", string);
+       fm.put("TT_lemma", lemma);
+     }
+
+     else if ( (lemma.length() > 1) && lemma.contains("|")) {
+        String[] splits = org.apache.commons.lang.StringUtils.split(lemma, 
'|');
+        if (splits.length > 0) {
+          fm.put("lemma", splits[0]);
+          fm.put("TT_lemma", lemma);
+        }
+     }
+  }
+  else {
+     String string = fm.get("string").toString();
+     fm.put("lemma", string);
+     fm.put("TT_lemma", "<missing>");
+  }
+
+}

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to