You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2006/12/07 23:40:30 UTC
svn commit: r483709 [4/5] - in
/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src:
com/ibm/uima/examples/opennlp/ com/ibm/uima/examples/opennlp/annotator/
org/ org/apache/ org/apache/uima/ org/apache/uima/examples/
org/apache/uima...
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/Token_Type.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/Token_Type.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/Token_Type.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/Token_Type.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/Token_Type.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/Token_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/Token_Type.java Thu Dec 7 14:40:23 2006
@@ -29,88 +29,101 @@
import org.apache.uima.cas.Feature;
import org.apache.uima.jcas.tcas.Annotation_Type;
-/**
+/**
* Updated by JCasGen Fri Dec 02 14:22:23 EST 2005
- * @generated */
+ *
+ * @generated
+ */
public class Token_Type extends Annotation_Type {
/** @generated */
- protected FSGenerator getFSGenerator() {return fsGenerator;};
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
/** @generated */
- private final FSGenerator fsGenerator =
- new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (Token_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = Token_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new Token(addr, Token_Type.this);
- Token_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else return new Token(addr, Token_Type.this);
- }
- };
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (Token_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = Token_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new Token(addr, Token_Type.this);
+ Token_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new Token(addr, Token_Type.this);
+ }
+ };
+
/** @generated */
public final static int typeIndexID = Token.typeIndexID;
- /** @generated
- @modifiable */
- public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.Token");
-
+
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCas
+ .getFeatOkTst("org.apache.uima.examples.opennlp.Token");
+
/** @generated */
final Feature casFeat_posTag;
+
+ /** @generated */
+ final int casFeatCode_posTag;
+
/** @generated */
- final int casFeatCode_posTag;
- /** @generated */
public String getPosTag(int addr) {
- if (featOkTst && casFeat_posTag == null)
+ if (featOkTst && casFeat_posTag == null)
JCas.throwFeatMissing("posTag", "org.apache.uima.examples.opennlp.Token");
return ll_cas.ll_getStringValue(addr, casFeatCode_posTag);
}
- /** @generated */
+
+ /** @generated */
public void setPosTag(int addr, String v) {
- if (featOkTst && casFeat_posTag == null)
+ if (featOkTst && casFeat_posTag == null)
JCas.throwFeatMissing("posTag", "org.apache.uima.examples.opennlp.Token");
- ll_cas.ll_setStringValue(addr, casFeatCode_posTag, v);}
-
-
-
+ ll_cas.ll_setStringValue(addr, casFeatCode_posTag, v);
+ }
+
/** @generated */
final Feature casFeat_componentId;
+
+ /** @generated */
+ final int casFeatCode_componentId;
+
/** @generated */
- final int casFeatCode_componentId;
- /** @generated */
public String getComponentId(int addr) {
- if (featOkTst && casFeat_componentId == null)
+ if (featOkTst && casFeat_componentId == null)
JCas.throwFeatMissing("componentId", "org.apache.uima.examples.opennlp.Token");
return ll_cas.ll_getStringValue(addr, casFeatCode_componentId);
}
- /** @generated */
+
+ /** @generated */
public void setComponentId(int addr, String v) {
- if (featOkTst && casFeat_componentId == null)
+ if (featOkTst && casFeat_componentId == null)
JCas.throwFeatMissing("componentId", "org.apache.uima.examples.opennlp.Token");
- ll_cas.ll_setStringValue(addr, casFeatCode_componentId, v);}
-
-
-
+ ll_cas.ll_setStringValue(addr, casFeatCode_componentId, v);
+ }
- /** initialize variables to correspond with Cas Type and Features
- * @generated */
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
public Token_Type(JCas jcas, Type casType) {
super(jcas, casType);
- casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
-
casFeat_posTag = jcas.getRequiredFeatureDE(casType, "posTag", "uima.cas.String", featOkTst);
- casFeatCode_posTag = (null == casFeat_posTag) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_posTag).getCode();
+ casFeatCode_posTag = (null == casFeat_posTag) ? JCas.INVALID_FEATURE_CODE
+ : ((FeatureImpl) casFeat_posTag).getCode();
-
- casFeat_componentId = jcas.getRequiredFeatureDE(casType, "componentId", "uima.cas.String", featOkTst);
- casFeatCode_componentId = (null == casFeat_componentId) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_componentId).getCode();
+ casFeat_componentId = jcas.getRequiredFeatureDE(casType, "componentId", "uima.cas.String",
+ featOkTst);
+ casFeatCode_componentId = (null == casFeat_componentId) ? JCas.INVALID_FEATURE_CODE
+ : ((FeatureImpl) casFeat_componentId).getCode();
}
}
-
-
-
-
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/UCP.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/UCP.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/UCP.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/UCP.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/UCP.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/UCP.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/UCP.java Thu Dec 7 14:40:23 2006
@@ -19,57 +19,70 @@
package org.apache.uima.examples.opennlp;
-import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.jcas.impl.JCas;
import org.apache.uima.jcas.cas.TOP_Type;
-
-
-/** Unlike Coordinated Phrase.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * XML source: C:/workspace/jedii_examples/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
- * @generated */
+/**
+ * Unlike Coordinated Phrase. Updated by JCasGen Fri Dec 02 14:22:24 EST 2005 XML source:
+ * c:/workspace/uimaj-examples/opennlp/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
+ *
+ * @generated
+ */
public class UCP extends Phrase {
- /** @generated
- * @ordered
+ /**
+ * @generated
+ * @ordered
*/
public final static int typeIndexID = JCas.getNextIndex();
- /** @generated
- * @ordered
+
+ /**
+ * @generated
+ * @ordered
*/
public final static int type = typeIndexID;
- /** @generated */
- public int getTypeIndexID() {return typeIndexID;}
-
- /** Never called. Disable default constructor
- * @generated */
- protected UCP() {}
-
- /** Internal - constructor used by generator
- * @generated */
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected UCP() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
public UCP(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
-
+
/** @generated */
public UCP(JCas jcas) {
super(jcas);
- readObject();
- }
-
+ readObject();
+ }
+
public UCP(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
- }
+ }
- /** <!-- begin-user-doc -->
- * Write your own initialization here
- * <!-- end-user-doc -->
- @generated modifiable */
- private void readObject() {}
-
-}
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
-
+}
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/UCP_Type.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/UCP_Type.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/UCP_Type.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/UCP_Type.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/UCP_Type.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/UCP_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/UCP_Type.java Thu Dec 7 14:40:23 2006
@@ -26,44 +26,51 @@
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
-/** Unlike Coordinated Phrase.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * @generated */
+/**
+ * Unlike Coordinated Phrase. Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
+ *
+ * @generated
+ */
public class UCP_Type extends Phrase_Type {
/** @generated */
- protected FSGenerator getFSGenerator() {return fsGenerator;};
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
/** @generated */
- private final FSGenerator fsGenerator =
- new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (UCP_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = UCP_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new UCP(addr, UCP_Type.this);
- UCP_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else return new UCP(addr, UCP_Type.this);
- }
- };
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (UCP_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = UCP_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new UCP(addr, UCP_Type.this);
+ UCP_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new UCP(addr, UCP_Type.this);
+ }
+ };
+
/** @generated */
public final static int typeIndexID = UCP.typeIndexID;
- /** @generated
- @modifiable */
- public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.UCP");
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.UCP");
- /** initialize variables to correspond with Cas Type and Features
- * @generated */
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
public UCP_Type(JCas jcas, Type casType) {
super(jcas, casType);
- casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
}
}
-
-
-
-
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/VP.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/VP.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/VP.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/VP.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/VP.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/VP.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/VP.java Thu Dec 7 14:40:23 2006
@@ -19,57 +19,70 @@
package org.apache.uima.examples.opennlp;
-import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.jcas.impl.JCas;
import org.apache.uima.jcas.cas.TOP_Type;
-
-
-/** Vereb Phrase.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * XML source: C:/workspace/jedii_examples/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
- * @generated */
+/**
+ * Vereb Phrase. Updated by JCasGen Fri Dec 02 14:22:24 EST 2005 XML source:
+ * c:/workspace/uimaj-examples/opennlp/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
+ *
+ * @generated
+ */
public class VP extends Phrase {
- /** @generated
- * @ordered
+ /**
+ * @generated
+ * @ordered
*/
public final static int typeIndexID = JCas.getNextIndex();
- /** @generated
- * @ordered
+
+ /**
+ * @generated
+ * @ordered
*/
public final static int type = typeIndexID;
- /** @generated */
- public int getTypeIndexID() {return typeIndexID;}
-
- /** Never called. Disable default constructor
- * @generated */
- protected VP() {}
-
- /** Internal - constructor used by generator
- * @generated */
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected VP() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
public VP(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
-
+
/** @generated */
public VP(JCas jcas) {
super(jcas);
- readObject();
- }
-
+ readObject();
+ }
+
public VP(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
- }
+ }
- /** <!-- begin-user-doc -->
- * Write your own initialization here
- * <!-- end-user-doc -->
- @generated modifiable */
- private void readObject() {}
-
-}
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
-
+}
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/VP_Type.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/VP_Type.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/VP_Type.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/VP_Type.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/VP_Type.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/VP_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/VP_Type.java Thu Dec 7 14:40:23 2006
@@ -26,44 +26,51 @@
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
-/** Vereb Phrase.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * @generated */
+/**
+ * Vereb Phrase. Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
+ *
+ * @generated
+ */
public class VP_Type extends Phrase_Type {
/** @generated */
- protected FSGenerator getFSGenerator() {return fsGenerator;};
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
/** @generated */
- private final FSGenerator fsGenerator =
- new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (VP_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = VP_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new VP(addr, VP_Type.this);
- VP_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else return new VP(addr, VP_Type.this);
- }
- };
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (VP_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = VP_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new VP(addr, VP_Type.this);
+ VP_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new VP(addr, VP_Type.this);
+ }
+ };
+
/** @generated */
public final static int typeIndexID = VP.typeIndexID;
- /** @generated
- @modifiable */
- public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.VP");
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.VP");
- /** initialize variables to correspond with Cas Type and Features
- * @generated */
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
public VP_Type(JCas jcas, Type casType) {
super(jcas, casType);
- casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
}
}
-
-
-
-
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHADJP.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHADJP.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHADJP.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHADJP.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHADJP.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHADJP.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHADJP.java Thu Dec 7 14:40:23 2006
@@ -19,57 +19,71 @@
package org.apache.uima.examples.opennlp;
-import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.jcas.impl.JCas;
import org.apache.uima.jcas.cas.TOP_Type;
-
-
-/** Wh-adjective Phrase. Adjectival phrase containing a wh-adverb, as in how hot.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * XML source: C:/workspace/jedii_examples/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
- * @generated */
+/**
+ * Wh-adjective Phrase. Adjectival phrase containing a wh-adverb, as in how hot. Updated by JCasGen
+ * Fri Dec 02 14:22:24 EST 2005 XML source:
+ * c:/workspace/uimaj-examples/opennlp/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
+ *
+ * @generated
+ */
public class WHADJP extends Phrase {
- /** @generated
- * @ordered
+ /**
+ * @generated
+ * @ordered
*/
public final static int typeIndexID = JCas.getNextIndex();
- /** @generated
- * @ordered
+
+ /**
+ * @generated
+ * @ordered
*/
public final static int type = typeIndexID;
- /** @generated */
- public int getTypeIndexID() {return typeIndexID;}
-
- /** Never called. Disable default constructor
- * @generated */
- protected WHADJP() {}
-
- /** Internal - constructor used by generator
- * @generated */
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected WHADJP() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
public WHADJP(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
-
+
/** @generated */
public WHADJP(JCas jcas) {
super(jcas);
- readObject();
- }
-
+ readObject();
+ }
+
public WHADJP(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
- }
+ }
- /** <!-- begin-user-doc -->
- * Write your own initialization here
- * <!-- end-user-doc -->
- @generated modifiable */
- private void readObject() {}
-
-}
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
-
+}
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHADJP_Type.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHADJP_Type.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHADJP_Type.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHADJP_Type.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHADJP_Type.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHADJP_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHADJP_Type.java Thu Dec 7 14:40:23 2006
@@ -26,44 +26,53 @@
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
-/** Wh-adjective Phrase. Adjectival phrase containing a wh-adverb, as in how hot.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * @generated */
+/**
+ * Wh-adjective Phrase. Adjectival phrase containing a wh-adverb, as in how hot. Updated by JCasGen
+ * Fri Dec 02 14:22:24 EST 2005
+ *
+ * @generated
+ */
public class WHADJP_Type extends Phrase_Type {
/** @generated */
- protected FSGenerator getFSGenerator() {return fsGenerator;};
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
/** @generated */
- private final FSGenerator fsGenerator =
- new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (WHADJP_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = WHADJP_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new WHADJP(addr, WHADJP_Type.this);
- WHADJP_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else return new WHADJP(addr, WHADJP_Type.this);
- }
- };
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (WHADJP_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = WHADJP_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new WHADJP(addr, WHADJP_Type.this);
+ WHADJP_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new WHADJP(addr, WHADJP_Type.this);
+ }
+ };
+
/** @generated */
public final static int typeIndexID = WHADJP.typeIndexID;
- /** @generated
- @modifiable */
- public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.WHADJP");
-
- /** initialize variables to correspond with Cas Type and Features
- * @generated */
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCas
+ .getFeatOkTst("org.apache.uima.examples.opennlp.WHADJP");
+
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
public WHADJP_Type(JCas jcas, Type casType) {
super(jcas, casType);
- casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
}
}
-
-
-
-
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHAVP.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHAVP.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHAVP.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHAVP.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHAVP.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHAVP.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHAVP.java Thu Dec 7 14:40:23 2006
@@ -19,57 +19,72 @@
package org.apache.uima.examples.opennlp;
-import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.jcas.impl.JCas;
import org.apache.uima.jcas.cas.TOP_Type;
-
-
-/** Wh-adverb Phrase. Introduces a clause with an NP gap. May be null (containing the 0 complementizer) or lexical, containing a wh-adverb such as how or why.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * XML source: C:/workspace/jedii_examples/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
- * @generated */
+/**
+ * Wh-adverb Phrase. Introduces a clause with an NP gap. May be null (containing the 0
+ * complementizer) or lexical, containing a wh-adverb such as how or why. Updated by JCasGen Fri Dec
+ * 02 14:22:24 EST 2005 XML source:
+ * c:/workspace/uimaj-examples/opennlp/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
+ *
+ * @generated
+ */
public class WHAVP extends Phrase {
- /** @generated
- * @ordered
+ /**
+ * @generated
+ * @ordered
*/
public final static int typeIndexID = JCas.getNextIndex();
- /** @generated
- * @ordered
+
+ /**
+ * @generated
+ * @ordered
*/
public final static int type = typeIndexID;
- /** @generated */
- public int getTypeIndexID() {return typeIndexID;}
-
- /** Never called. Disable default constructor
- * @generated */
- protected WHAVP() {}
-
- /** Internal - constructor used by generator
- * @generated */
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected WHAVP() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
public WHAVP(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
-
+
/** @generated */
public WHAVP(JCas jcas) {
super(jcas);
- readObject();
- }
-
+ readObject();
+ }
+
public WHAVP(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
- }
+ }
- /** <!-- begin-user-doc -->
- * Write your own initialization here
- * <!-- end-user-doc -->
- @generated modifiable */
- private void readObject() {}
-
-}
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
-
+}
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHAVP_Type.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHAVP_Type.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHAVP_Type.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHAVP_Type.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHAVP_Type.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHAVP_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHAVP_Type.java Thu Dec 7 14:40:23 2006
@@ -26,44 +26,54 @@
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
-/** Wh-adverb Phrase. Introduces a clause with an NP gap. May be null (containing the 0 complementizer) or lexical, containing a wh-adverb such as how or why.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * @generated */
+/**
+ * Wh-adverb Phrase. Introduces a clause with an NP gap. May be null (containing the 0
+ * complementizer) or lexical, containing a wh-adverb such as how or why. Updated by JCasGen Fri Dec
+ * 02 14:22:24 EST 2005
+ *
+ * @generated
+ */
public class WHAVP_Type extends Phrase_Type {
/** @generated */
- protected FSGenerator getFSGenerator() {return fsGenerator;};
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
/** @generated */
- private final FSGenerator fsGenerator =
- new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (WHAVP_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = WHAVP_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new WHAVP(addr, WHAVP_Type.this);
- WHAVP_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else return new WHAVP(addr, WHAVP_Type.this);
- }
- };
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (WHAVP_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = WHAVP_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new WHAVP(addr, WHAVP_Type.this);
+ WHAVP_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new WHAVP(addr, WHAVP_Type.this);
+ }
+ };
+
/** @generated */
public final static int typeIndexID = WHAVP.typeIndexID;
- /** @generated
- @modifiable */
- public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.WHAVP");
-
- /** initialize variables to correspond with Cas Type and Features
- * @generated */
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCas
+ .getFeatOkTst("org.apache.uima.examples.opennlp.WHAVP");
+
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
public WHAVP_Type(JCas jcas, Type casType) {
super(jcas, casType);
- casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
}
}
-
-
-
-
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHNP.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHNP.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHNP.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHNP.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHNP.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHNP.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHNP.java Thu Dec 7 14:40:23 2006
@@ -19,57 +19,72 @@
package org.apache.uima.examples.opennlp;
-import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.jcas.impl.JCas;
import org.apache.uima.jcas.cas.TOP_Type;
-
-
-/** Wh-noun Phrase. Introduces a clause with an NP gap. May be null (containing the 0 complementizer) or lexical, containing some wh-word, e.g. who, which book, whose daughter, none of which, or how many leopards.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * XML source: C:/workspace/jedii_examples/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
- * @generated */
+/**
+ * Wh-noun Phrase. Introduces a clause with an NP gap. May be null (containing the 0 complementizer)
+ * or lexical, containing some wh-word, e.g. who, which book, whose daughter, none of which, or how
+ * many leopards. Updated by JCasGen Fri Dec 02 14:22:24 EST 2005 XML source:
+ * c:/workspace/uimaj-examples/opennlp/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
+ *
+ * @generated
+ */
public class WHNP extends Phrase {
- /** @generated
- * @ordered
+ /**
+ * @generated
+ * @ordered
*/
public final static int typeIndexID = JCas.getNextIndex();
- /** @generated
- * @ordered
+
+ /**
+ * @generated
+ * @ordered
*/
public final static int type = typeIndexID;
- /** @generated */
- public int getTypeIndexID() {return typeIndexID;}
-
- /** Never called. Disable default constructor
- * @generated */
- protected WHNP() {}
-
- /** Internal - constructor used by generator
- * @generated */
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected WHNP() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
public WHNP(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
-
+
/** @generated */
public WHNP(JCas jcas) {
super(jcas);
- readObject();
- }
-
+ readObject();
+ }
+
public WHNP(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
- }
+ }
- /** <!-- begin-user-doc -->
- * Write your own initialization here
- * <!-- end-user-doc -->
- @generated modifiable */
- private void readObject() {}
-
-}
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
-
+}
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHNP_Type.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHNP_Type.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHNP_Type.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHNP_Type.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHNP_Type.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHNP_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHNP_Type.java Thu Dec 7 14:40:23 2006
@@ -26,44 +26,54 @@
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
-/** Wh-noun Phrase. Introduces a clause with an NP gap. May be null (containing the 0 complementizer) or lexical, containing some wh-word, e.g. who, which book, whose daughter, none of which, or how many leopards.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * @generated */
+/**
+ * Wh-noun Phrase. Introduces a clause with an NP gap. May be null (containing the 0 complementizer)
+ * or lexical, containing some wh-word, e.g. who, which book, whose daughter, none of which, or how
+ * many leopards. Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
+ *
+ * @generated
+ */
public class WHNP_Type extends Phrase_Type {
/** @generated */
- protected FSGenerator getFSGenerator() {return fsGenerator;};
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
/** @generated */
- private final FSGenerator fsGenerator =
- new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (WHNP_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = WHNP_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new WHNP(addr, WHNP_Type.this);
- WHNP_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else return new WHNP(addr, WHNP_Type.this);
- }
- };
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (WHNP_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = WHNP_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new WHNP(addr, WHNP_Type.this);
+ WHNP_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new WHNP(addr, WHNP_Type.this);
+ }
+ };
+
/** @generated */
public final static int typeIndexID = WHNP.typeIndexID;
- /** @generated
- @modifiable */
- public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.WHNP");
-
- /** initialize variables to correspond with Cas Type and Features
- * @generated */
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCas
+ .getFeatOkTst("org.apache.uima.examples.opennlp.WHNP");
+
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
public WHNP_Type(JCas jcas, Type casType) {
super(jcas, casType);
- casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
}
}
-
-
-
-
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHPP.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHPP.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHPP.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHPP.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHPP.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHPP.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHPP.java Thu Dec 7 14:40:23 2006
@@ -19,57 +19,72 @@
package org.apache.uima.examples.opennlp;
-import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.jcas.impl.JCas;
import org.apache.uima.jcas.cas.TOP_Type;
-
-
-/** Wh-prepositional Phrase. Prepositional phrase containing a wh-noun phrase (such as of which or by whose authority) that either introduces a PP gap or is contained by a WHNP.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * XML source: C:/workspace/jedii_examples/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
- * @generated */
+/**
+ * Wh-prepositional Phrase. Prepositional phrase containing a wh-noun phrase (such as of which or by
+ * whose authority) that either introduces a PP gap or is contained by a WHNP. Updated by JCasGen
+ * Fri Dec 02 14:22:24 EST 2005 XML source:
+ * c:/workspace/uimaj-examples/opennlp/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
+ *
+ * @generated
+ */
public class WHPP extends Phrase {
- /** @generated
- * @ordered
+ /**
+ * @generated
+ * @ordered
*/
public final static int typeIndexID = JCas.getNextIndex();
- /** @generated
- * @ordered
+
+ /**
+ * @generated
+ * @ordered
*/
public final static int type = typeIndexID;
- /** @generated */
- public int getTypeIndexID() {return typeIndexID;}
-
- /** Never called. Disable default constructor
- * @generated */
- protected WHPP() {}
-
- /** Internal - constructor used by generator
- * @generated */
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected WHPP() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
public WHPP(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
-
+
/** @generated */
public WHPP(JCas jcas) {
super(jcas);
- readObject();
- }
-
+ readObject();
+ }
+
public WHPP(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
- }
+ }
- /** <!-- begin-user-doc -->
- * Write your own initialization here
- * <!-- end-user-doc -->
- @generated modifiable */
- private void readObject() {}
-
-}
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
-
+}
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHPP_Type.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHPP_Type.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHPP_Type.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHPP_Type.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHPP_Type.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/WHPP_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/WHPP_Type.java Thu Dec 7 14:40:23 2006
@@ -26,44 +26,54 @@
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
-/** Wh-prepositional Phrase. Prepositional phrase containing a wh-noun phrase (such as of which or by whose authority) that either introduces a PP gap or is contained by a WHNP.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * @generated */
+/**
+ * Wh-prepositional Phrase. Prepositional phrase containing a wh-noun phrase (such as of which or by
+ * whose authority) that either introduces a PP gap or is contained by a WHNP. Updated by JCasGen
+ * Fri Dec 02 14:22:24 EST 2005
+ *
+ * @generated
+ */
public class WHPP_Type extends Phrase_Type {
/** @generated */
- protected FSGenerator getFSGenerator() {return fsGenerator;};
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
/** @generated */
- private final FSGenerator fsGenerator =
- new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (WHPP_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = WHPP_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new WHPP(addr, WHPP_Type.this);
- WHPP_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else return new WHPP(addr, WHPP_Type.this);
- }
- };
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (WHPP_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = WHPP_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new WHPP(addr, WHPP_Type.this);
+ WHPP_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new WHPP(addr, WHPP_Type.this);
+ }
+ };
+
/** @generated */
public final static int typeIndexID = WHPP.typeIndexID;
- /** @generated
- @modifiable */
- public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.WHPP");
-
- /** initialize variables to correspond with Cas Type and Features
- * @generated */
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCas
+ .getFeatOkTst("org.apache.uima.examples.opennlp.WHPP");
+
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
public WHPP_Type(JCas jcas, Type casType) {
super(jcas, casType);
- casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
}
}
-
-
-
-
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/X.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/X.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/X.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/X.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/X.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/X.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/X.java Thu Dec 7 14:40:23 2006
@@ -19,57 +19,71 @@
package org.apache.uima.examples.opennlp;
-import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.jcas.impl.JCas;
import org.apache.uima.jcas.cas.TOP_Type;
-
-
-/** Unknown, uncertain, or unbracketable. X is often used for bracketing typos and in bracketing the...the-constructions.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * XML source: C:/workspace/jedii_examples/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
- * @generated */
+/**
+ * Unknown, uncertain, or unbracketable. X is often used for bracketing typos and in bracketing
+ * the...the-constructions. Updated by JCasGen Fri Dec 02 14:22:24 EST 2005 XML source:
+ * c:/workspace/uimaj-examples/opennlp/src/org/apache/uima/examples/opennlp/annotator/OpenNLPExampleTypes.xml
+ *
+ * @generated
+ */
public class X extends Phrase {
- /** @generated
- * @ordered
+ /**
+ * @generated
+ * @ordered
*/
public final static int typeIndexID = JCas.getNextIndex();
- /** @generated
- * @ordered
+
+ /**
+ * @generated
+ * @ordered
*/
public final static int type = typeIndexID;
- /** @generated */
- public int getTypeIndexID() {return typeIndexID;}
-
- /** Never called. Disable default constructor
- * @generated */
- protected X() {}
-
- /** Internal - constructor used by generator
- * @generated */
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected X() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
public X(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
-
+
/** @generated */
public X(JCas jcas) {
super(jcas);
- readObject();
- }
-
+ readObject();
+ }
+
public X(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
- }
+ }
- /** <!-- begin-user-doc -->
- * Write your own initialization here
- * <!-- end-user-doc -->
- @generated modifiable */
- private void readObject() {}
-
-}
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
-
+}
Copied: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/X_Type.java (from r477887, incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/X_Type.java)
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/X_Type.java?view=diff&rev=483709&p1=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/X_Type.java&r1=477887&p2=incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/X_Type.java&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/com/ibm/uima/examples/opennlp/X_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/X_Type.java Thu Dec 7 14:40:23 2006
@@ -26,44 +26,52 @@
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
-/** Unknown, uncertain, or unbracketable. X is often used for bracketing typos and in bracketing the...the-constructions.
- * Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
- * @generated */
+/**
+ * Unknown, uncertain, or unbracketable. X is often used for bracketing typos and in bracketing
+ * the...the-constructions. Updated by JCasGen Fri Dec 02 14:22:24 EST 2005
+ *
+ * @generated
+ */
public class X_Type extends Phrase_Type {
/** @generated */
- protected FSGenerator getFSGenerator() {return fsGenerator;};
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
/** @generated */
- private final FSGenerator fsGenerator =
- new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (X_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = X_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new X(addr, X_Type.this);
- X_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else return new X(addr, X_Type.this);
- }
- };
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (X_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = X_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new X(addr, X_Type.this);
+ X_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new X(addr, X_Type.this);
+ }
+ };
+
/** @generated */
public final static int typeIndexID = X.typeIndexID;
- /** @generated
- @modifiable */
- public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.X");
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCas.getFeatOkTst("org.apache.uima.examples.opennlp.X");
- /** initialize variables to correspond with Cas Type and Features
- * @generated */
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
public X_Type(JCas jcas, Type casType) {
super(jcas, casType);
- casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
}
}
-
-
-
-
Modified: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/annotator/NEDetector.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/annotator/NEDetector.java?view=diff&rev=483709&r1=477887&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/annotator/NEDetector.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/annotator/NEDetector.java Thu Dec 7 14:40:23 2006
@@ -31,254 +31,249 @@
import opennlp.tools.lang.english.NameFinder;
import opennlp.tools.namefind.NameFinderME;
-import org.apache.uima.analysis_engine.ResultSpecification;
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.analysis_engine.annotator.AnnotatorConfigurationException;
-import org.apache.uima.analysis_engine.annotator.AnnotatorContext;
-import org.apache.uima.analysis_engine.annotator.AnnotatorInitializationException;
import org.apache.uima.analysis_engine.annotator.AnnotatorProcessException;
-import org.apache.uima.analysis_engine.annotator.JTextAnnotator_ImplBase;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.text.AnnotationIndex;
import org.apache.uima.examples.opennlp.EntityAnnotation;
import org.apache.uima.examples.opennlp.Sentence;
import org.apache.uima.examples.opennlp.Token;
import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
/**
- * UIMA wrapper for the OpenNLP named entity recognizer. The entity models
- * and corresponding annotation type classes are specified as parameters.
- * The document in the CAS is analyzed and a named entity annotation is
- * created for each entity found. We assume that any entity annotation type
- * class inherits from org.apache.uima.examples.opennlp.annotator.EntityAnnotation.
+ * UIMA wrapper for the OpenNLP named entity recognizer. The entity models and corresponding
+ * annotation type classes are specified as parameters. The document in the CAS is analyzed and a
+ * named entity annotation is created for each entity found. We assume that any entity annotation
+ * type class inherits from org.apache.uima.examples.opennlp.annotator.EntityAnnotation.
*/
-public class NEDetector extends JTextAnnotator_ImplBase {
+public class NEDetector extends JCasAnnotator_ImplBase {
- /* Model directory parameter name. */
- private static final String MODEL_DIR_PARAM = "ModelDirectory";
+ /* Model directory parameter name. */
+ private static final String MODEL_DIR_PARAM = "ModelDirectory";
- /* Mappings array parameter name. */
- private static final String MAPPINGS_PARAM = "EntityTypeMappings";
+ /* Mappings array parameter name. */
+ private static final String MAPPINGS_PARAM = "EntityTypeMappings";
- /* Name to use for this Analysis Engine component. */
- private static final String COMPONENT_NAME = "OpenNLP NE Detector";
-
- /* Array of named entity finders that will be run. */
- private NameFinder[] nameFinders;
-
- /* Array of labels for the named entity finders, derived from
- * the corresponding model file names (i.e., the filename minus ".bin.gz").
- */
- private String[] nameFinderLabels;
-
- /* Hash that maps named entity finder labels to the constructor for
- * the corresponding annotation type class.
- */
- private Hashtable labelMap = new Hashtable();
-
- /* Number of named entity finders. */
- private int numNefs = 0;
-
- /* Array of constructors for the annotation type classes. */
- private Constructor[] neAnnotationMakers;
-
- /**
- * A simple filename filter class to list all of the named entity model
- * files in the model directory.
- */
- private class modelFileFilter implements FilenameFilter {
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
- */
- public boolean accept(File dir, String name) {
- return name.endsWith(".bin.gz");
- }
- }
-
- /**
- * Initialize the Analysis Engine.
- *
- * @see org.apache.uima.analysis_engine.annotator.BaseAnnotator#initialize(org.apache.uima.analysis_engine.annotator.AnnotatorContext)
- */
- public void initialize(AnnotatorContext aContext)
- throws AnnotatorInitializationException, AnnotatorConfigurationException {
- super.initialize(aContext);
-
- try {
- String[] mappingStrings = null;
-
- mappingStrings = (String[]) aContext
- .getConfigParameterValue(MAPPINGS_PARAM);
- if (mappingStrings == null) {
- throw new AnnotatorConfigurationException();
- }
- loadMappings(mappingStrings);
-
- String modelDirName = (String) aContext
- .getConfigParameterValue(MODEL_DIR_PARAM);
-
- File modelDir = new File(modelDirName);
- if (!modelDir.isDirectory()) {
- throw new AnnotatorConfigurationException();
- }
- File[] modelFiles = modelDir.listFiles(new modelFileFilter());
- numNefs = modelFiles.length;
- nameFinders = new NameFinder[numNefs];
- nameFinderLabels = new String[numNefs];
- neAnnotationMakers = new Constructor[numNefs];
- for (int i = 0; i < numNefs; i++) {
- String modelName = modelFiles[i].getName();
- System.out.print("Loading model: " + modelName + "...");
- nameFinders[i] = new NameFinder(new SuffixSensitiveGISModelReader(
- modelFiles[i]).getModel());
- int nameStart = modelName.lastIndexOf(System
- .getProperty("file.separator")) + 1;
- int nameEnd = modelName.indexOf('.', nameStart);
- if (nameEnd == -1) {
- nameEnd = modelName.length();
- }
- nameFinderLabels[i] = modelName.substring(nameStart, nameEnd);
- Constructor annotationMaker;
- if ((annotationMaker = (Constructor) labelMap.get(nameFinderLabels[i])) == null) {
- throw new AnnotatorConfigurationException();
- }
- neAnnotationMakers[i] = annotationMaker;
- System.out.println("done");
- }
-
- } catch (Exception e) {
- throw new AnnotatorInitializationException(e);
- }
- }
-
- /**
- * Processes the entity type mappaings parameter. The constructor for
- * each class identified in the array is loaded and stored in the mapping
- * hashtable, using the label provided in the parameter as the key.
- *
- * @param mappingStrings Array of mapping strings of the form "labe,class"
- * @throws AnnotatorConfigurationException
- */
- private void loadMappings(String[] mappingStrings)
- throws AnnotatorConfigurationException {
- // populate the mappings hash table (key: entity label,CAS Annotation Type
- // Constructor)
- for (int i = 0; i < mappingStrings.length; i++) {
- String[] mappingPair = mappingStrings[i].split(",");
- if (mappingPair.length < 2)
- throw new AnnotatorConfigurationException();
-
- String modelName = mappingPair[0];
- String className = mappingPair[1];
-
- Constructor annotationConstructor;
- // get the name of the JCAS type with this name
- Class annotationClass;
- try {
- annotationClass = Class.forName(className);
- // get the constructor for that JCAS type
- annotationConstructor = annotationClass
- .getConstructor(new Class[] { JCas.class });
- } catch (Exception e) {
- throw new AnnotatorConfigurationException(e);
- }
- labelMap.put(modelName, annotationConstructor);
- }
- }
-
-
- /**
- * Process the CAS.
- *
- * @see org.apache.uima.analysis_engine.annotator.JTextAnnotator#process(org.apache.uima.jcas.impl.JCas, org.apache.uima.analysis_engine.ResultSpecification)
- */
- public void process(JCas aJCas, ResultSpecification resultSpec)
- throws AnnotatorProcessException {
-
- ArrayList tokenList = new ArrayList();
- ArrayList wordList = new ArrayList();
- List finderTags;
-
- AnnotationIndex sentenceIndex = (AnnotationIndex) aJCas
- .getJFSIndexRepository().getAnnotationIndex(Sentence.type);
- AnnotationIndex tokenIndex = (AnnotationIndex) aJCas
- .getJFSIndexRepository().getAnnotationIndex(Token.type);
-
- // iterate over Sentences
- FSIterator sentenceIterator = sentenceIndex.iterator();
- while (sentenceIterator.hasNext()) {
- Sentence sentence = (Sentence) sentenceIterator.next();
-
- tokenList.clear();
- wordList.clear();
-
- // iterate over Tokens
- FSIterator tokenIterator = tokenIndex.subiterator(sentence);
- while (tokenIterator.hasNext()) {
- Token token = (Token) tokenIterator.next();
-
- tokenList.add(token);
- wordList.add(token.getCoveredText());
- }
-
- for (int i = 0; i < numNefs; i++) {
- Constructor annotationMaker = neAnnotationMakers[i];
- finderTags = nameFinders[i].find(wordList, Collections.EMPTY_MAP);
-
- boolean inTag = false;
- int tagStart = 0;
- int tagEnd = 0;
- for (int j = 0; j < finderTags.size(); j++) {
- String tag = (String) finderTags.get(j);
-
- if (inTag) {
- // check for end tags
- if (tag.equals(NameFinderME.START)
- || tag.equals(NameFinderME.OTHER)) {
- // make annotation
- tagEnd = j - 1;
- Token startToken = (Token) tokenList.get(tagStart);
- Token endToken = (Token) tokenList.get(tagEnd);
- makeEntityAnnotation(annotationMaker, aJCas, startToken
- .getBegin(), endToken.getEnd());
- inTag = false;
- }
- }
- if (!inTag) {
- // check for start tags
- if (tag.equals(NameFinderME.START)) {
- tagStart = j;
- inTag = true;
- }
- }
- }
- }
- }
- }
-
- /**
- * Create a new EntityAnnotation using the supplied Constructor. The start,
- * end, and componentId features are set.
- *
- * @param annotationMaker Constructor to create the EntityAnnotation object
- * @param jCas The JCas in which to create the new annotation
- * @param start Start of annotation span
- * @param end End of annotation span
- * @throws AnnotatorProcessException
- */
- private void makeEntityAnnotation(Constructor annotationMaker, JCas jCas,
- int start, int end) throws AnnotatorProcessException {
- try {
- EntityAnnotation entityAnnot = (EntityAnnotation) annotationMaker
- .newInstance(new Object[] { jCas });
- entityAnnot.setBegin(start);
- entityAnnot.setEnd(end);
- entityAnnot.setComponentId(COMPONENT_NAME);
- entityAnnot.addToIndexes();
- } catch (Exception e) {
- throw new AnnotatorProcessException(e);
- }
- }
+ /* Name to use for this Analysis Engine component. */
+ private static final String COMPONENT_NAME = "OpenNLP NE Detector";
+
+ /* Array of named entity finders that will be run. */
+ private NameFinder[] nameFinders;
+
+ /*
+ * Array of labels for the named entity finders, derived from the corresponding model file names
+ * (i.e., the filename minus ".bin.gz").
+ */
+ private String[] nameFinderLabels;
+
+ /*
+ * Hash that maps named entity finder labels to the constructor for the corresponding annotation
+ * type class.
+ */
+ private Hashtable labelMap = new Hashtable();
+
+ /* Number of named entity finders. */
+ private int numNefs = 0;
+
+ /* Array of constructors for the annotation type classes. */
+ private Constructor[] neAnnotationMakers;
+
+ /**
+ * A simple filename filter class to list all of the named entity model files in the model
+ * directory.
+ */
+ private class modelFileFilter implements FilenameFilter {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
+ */
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".bin.gz");
+ }
+ }
+
+ /**
+ * Initialize the Annotator.
+ *
+ * @see JCasAnnotator_ImplBase#initialize(UimaContext)
+ */
+ public void initialize(UimaContext aContext) throws ResourceInitializationException {
+ super.initialize(aContext);
+
+ try {
+ String[] mappingStrings = null;
+
+ mappingStrings = (String[]) aContext.getConfigParameterValue(MAPPINGS_PARAM);
+ if (mappingStrings == null) {
+ throw new AnnotatorConfigurationException();
+ }
+ loadMappings(mappingStrings);
+
+ String modelDirName = (String) aContext.getConfigParameterValue(MODEL_DIR_PARAM);
+
+ File modelDir = new File(modelDirName);
+ if (!modelDir.isDirectory()) {
+ throw new AnnotatorConfigurationException();
+ }
+ File[] modelFiles = modelDir.listFiles(new modelFileFilter());
+ numNefs = modelFiles.length;
+ nameFinders = new NameFinder[numNefs];
+ nameFinderLabels = new String[numNefs];
+ neAnnotationMakers = new Constructor[numNefs];
+ for (int i = 0; i < numNefs; i++) {
+ String modelName = modelFiles[i].getName();
+ System.out.print("Loading model: " + modelName + "...");
+ nameFinders[i] = new NameFinder(new SuffixSensitiveGISModelReader(modelFiles[i]).getModel());
+ int nameStart = modelName.lastIndexOf(System.getProperty("file.separator")) + 1;
+ int nameEnd = modelName.indexOf('.', nameStart);
+ if (nameEnd == -1) {
+ nameEnd = modelName.length();
+ }
+ nameFinderLabels[i] = modelName.substring(nameStart, nameEnd);
+ Constructor annotationMaker;
+ if ((annotationMaker = (Constructor) labelMap.get(nameFinderLabels[i])) == null) {
+ throw new AnnotatorConfigurationException();
+ }
+ neAnnotationMakers[i] = annotationMaker;
+ System.out.println("done");
+ }
+
+ } catch (Exception e) {
+ throw new ResourceInitializationException(e);
+ }
+ }
+
+ /**
+ * Processes the entity type mappaings parameter. The constructor for each class identified in the
+ * array is loaded and stored in the mapping hashtable, using the label provided in the parameter
+ * as the key.
+ *
+ * @param mappingStrings
+ * Array of mapping strings of the form "labe,class"
+ * @throws AnnotatorConfigurationException
+ */
+ private void loadMappings(String[] mappingStrings) throws AnnotatorConfigurationException {
+ // populate the mappings hash table (key: entity label,CAS Annotation Type
+ // Constructor)
+ for (int i = 0; i < mappingStrings.length; i++) {
+ String[] mappingPair = mappingStrings[i].split(",");
+ if (mappingPair.length < 2)
+ throw new AnnotatorConfigurationException();
+
+ String modelName = mappingPair[0];
+ String className = mappingPair[1];
+
+ Constructor annotationConstructor;
+ // get the name of the JCAS type with this name
+ Class annotationClass;
+ try {
+ annotationClass = Class.forName(className);
+ // get the constructor for that JCAS type
+ annotationConstructor = annotationClass.getConstructor(new Class[] { JCas.class });
+ } catch (Exception e) {
+ throw new AnnotatorConfigurationException(e);
+ }
+ labelMap.put(modelName, annotationConstructor);
+ }
+ }
+
+ /**
+ * Process a CAS.
+ *
+ * @see JCasAnnotator_ImplBase#process(JCas)
+ */
+ public void process(JCas aJCas) throws AnalysisEngineProcessException {
+
+ ArrayList tokenList = new ArrayList();
+ ArrayList wordList = new ArrayList();
+ List finderTags;
+
+ AnnotationIndex sentenceIndex = (AnnotationIndex) aJCas.getJFSIndexRepository()
+ .getAnnotationIndex(Sentence.type);
+ AnnotationIndex tokenIndex = (AnnotationIndex) aJCas.getJFSIndexRepository()
+ .getAnnotationIndex(Token.type);
+
+ // iterate over Sentences
+ FSIterator sentenceIterator = sentenceIndex.iterator();
+ while (sentenceIterator.hasNext()) {
+ Sentence sentence = (Sentence) sentenceIterator.next();
+
+ tokenList.clear();
+ wordList.clear();
+
+ // iterate over Tokens
+ FSIterator tokenIterator = tokenIndex.subiterator(sentence);
+ while (tokenIterator.hasNext()) {
+ Token token = (Token) tokenIterator.next();
+
+ tokenList.add(token);
+ wordList.add(token.getCoveredText());
+ }
+
+ for (int i = 0; i < numNefs; i++) {
+ Constructor annotationMaker = neAnnotationMakers[i];
+ finderTags = nameFinders[i].find(wordList, Collections.EMPTY_MAP);
+
+ boolean inTag = false;
+ int tagStart = 0;
+ int tagEnd = 0;
+ for (int j = 0; j < finderTags.size(); j++) {
+ String tag = (String) finderTags.get(j);
+
+ if (inTag) {
+ // check for end tags
+ if (tag.equals(NameFinderME.START) || tag.equals(NameFinderME.OTHER)) {
+ // make annotation
+ tagEnd = j - 1;
+ Token startToken = (Token) tokenList.get(tagStart);
+ Token endToken = (Token) tokenList.get(tagEnd);
+ makeEntityAnnotation(annotationMaker, aJCas, startToken.getBegin(), endToken.getEnd());
+ inTag = false;
+ }
+ }
+ if (!inTag) {
+ // check for start tags
+ if (tag.equals(NameFinderME.START)) {
+ tagStart = j;
+ inTag = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a new EntityAnnotation using the supplied Constructor. The start, end, and componentId
+ * features are set.
+ *
+ * @param annotationMaker
+ * Constructor to create the EntityAnnotation object
+ * @param jCas
+ * The JCas in which to create the new annotation
+ * @param start
+ * Start of annotation span
+ * @param end
+ * End of annotation span
+ * @throws AnnotatorProcessException
+ */
+ private void makeEntityAnnotation(Constructor annotationMaker, JCas jCas, int start, int end)
+ throws AnalysisEngineProcessException {
+ try {
+ EntityAnnotation entityAnnot = (EntityAnnotation) annotationMaker
+ .newInstance(new Object[] { jCas });
+ entityAnnot.setBegin(start);
+ entityAnnot.setEnd(end);
+ entityAnnot.setComponentId(COMPONENT_NAME);
+ entityAnnot.addToIndexes();
+ } catch (Exception e) {
+ throw new AnalysisEngineProcessException(e);
+ }
+ }
}
Modified: incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/annotator/POSTagger.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/annotator/POSTagger.java?view=diff&rev=483709&r1=477887&r2=483709
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/annotator/POSTagger.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/opennlp_wrappers/src/org/apache/uima/examples/opennlp/annotator/POSTagger.java Thu Dec 7 14:40:23 2006
@@ -25,102 +25,93 @@
import opennlp.tools.lang.english.PosTagger;
import opennlp.tools.ngram.Dictionary;
-import org.apache.uima.analysis_engine.ResultSpecification;
-import org.apache.uima.analysis_engine.annotator.AnnotatorConfigurationException;
-import org.apache.uima.analysis_engine.annotator.AnnotatorContext;
-import org.apache.uima.analysis_engine.annotator.AnnotatorInitializationException;
-import org.apache.uima.analysis_engine.annotator.AnnotatorProcessException;
-import org.apache.uima.analysis_engine.annotator.JTextAnnotator_ImplBase;
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.text.AnnotationIndex;
import org.apache.uima.examples.opennlp.Sentence;
import org.apache.uima.examples.opennlp.Token;
import org.apache.uima.jcas.impl.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
/**
- * UIMA Analysis Engine that invokes the OpenNLP POS tagger. The OpenNLP POS
- * tagger generates a PennTreeBank style POS tags. This annotator assumes that
- * sentences and tokens have already been annotated in the CAS with Sentence and
- * Token annotations, respectively. We iterate over sentences, then iterate over
- * tokens in the current sentece to accumlate a list of words, then invoke the
- * OpenNLP POS tagger on the list of words. For each Token we then update the
- * posTag field with the POS tag. The model file for the OpenNLP POS tagger is
- * specified as a parameter (MODEL_FILE_PARAM).
+ * UIMA Analysis Engine that invokes the OpenNLP POS tagger. The OpenNLP POS tagger generates a
+ * PennTreeBank style POS tags. This annotator assumes that sentences and tokens have already been
+ * annotated in the CAS with Sentence and Token annotations, respectively. We iterate over
+ * sentences, then iterate over tokens in the current sentece to accumlate a list of words, then
+ * invoke the OpenNLP POS tagger on the list of words. For each Token we then update the posTag
+ * field with the POS tag. The model file for the OpenNLP POS tagger is specified as a parameter
+ * (MODEL_FILE_PARAM).
*
*/
-public class POSTagger extends JTextAnnotator_ImplBase {
+public class POSTagger extends JCasAnnotator_ImplBase {
- public static final String MODEL_FILE_PARAM = "ModelFile";
+ public static final String MODEL_FILE_PARAM = "ModelFile";
- private PosTagger tagger;
+ private PosTagger tagger;
- /*
- * (non-Javadoc)
- *
- * @see org.apache.uima.analysis_engine.annotator.BaseAnnotator#initialize(org.apache.uima.analysis_engine.annotator.AnnotatorContext)
- */
- public void initialize(AnnotatorContext aContext)
- throws AnnotatorInitializationException,
- AnnotatorConfigurationException {
- super.initialize(aContext);
-
- try {
- // Get configuration parameter values
- String modelFile = (String) aContext
- .getConfigParameterValue(MODEL_FILE_PARAM);
- tagger = new PosTagger(modelFile, (Dictionary)null);
- } catch (Exception e) {
- throw new AnnotatorInitializationException(e);
- }
+ /**
+ * Initialize the Annotator.
+ *
+ * @see JCasAnnotator_ImplBase#initialize(UimaContext)
+ */
+ public void initialize(UimaContext aContext) throws ResourceInitializationException {
+ super.initialize(aContext);
+
+ try {
+ // Get configuration parameter values
+ String modelFile = (String) aContext.getConfigParameterValue(MODEL_FILE_PARAM);
+ tagger = new PosTagger(modelFile, (Dictionary) null);
+ } catch (Exception e) {
+ throw new ResourceInitializationException(e);
}
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.apache.uima.analysis_engine.annotator.JTextAnnotator#process(org.apache.uima.jcas.impl.JCas,
- * org.apache.uima.analysis_engine.ResultSpecification)
- */
- public void process(JCas aJCas, ResultSpecification aResultSpec)
- throws AnnotatorProcessException {
-
- ArrayList tokenList = new ArrayList();
- ArrayList wordList = new ArrayList();
-
- AnnotationIndex sentenceIndex = (AnnotationIndex) aJCas
- .getJFSIndexRepository().getAnnotationIndex(Sentence.type);
- AnnotationIndex tokenIndex = (AnnotationIndex) aJCas
- .getJFSIndexRepository().getAnnotationIndex(Token.type);
-
- // iterate over Sentences
- FSIterator sentenceIterator = sentenceIndex.iterator();
- while (sentenceIterator.hasNext()) {
- Sentence sentence = (Sentence) sentenceIterator.next();
-
- tokenList.clear();
- wordList.clear();
-
- // iterate over Tokens
- FSIterator tokenIterator = tokenIndex.subiterator(sentence);
- while (tokenIterator.hasNext()) {
- Token token = (Token) tokenIterator.next();
-
- tokenList.add(token);
- wordList.add(token.getCoveredText());
- }
-
- List wordTagList = tagger.tag(wordList);
-
- try {
- for (int i = 0; i < tokenList.size(); i++) {
- Token token = (Token) tokenList.get(i);
- String posTag = (String) wordTagList.get(i);
- token.setPosTag(posTag);
- }
- } catch (IndexOutOfBoundsException e) {
- System.err
- .println("POS tagger error - list of tags shorter than list of words");
- }
+ /**
+ * Process a CAS.
+ *
+ * @see JCasAnnotator_ImplBase#process(JCas)
+ */
+ public void process(JCas aJCas) throws AnalysisEngineProcessException {
+
+ ArrayList tokenList = new ArrayList();
+ ArrayList wordList = new ArrayList();
+
+ AnnotationIndex sentenceIndex = (AnnotationIndex) aJCas.getJFSIndexRepository()
+ .getAnnotationIndex(Sentence.type);
+ AnnotationIndex tokenIndex = (AnnotationIndex) aJCas.getJFSIndexRepository()
+ .getAnnotationIndex(Token.type);
+
+ // iterate over Sentences
+ FSIterator sentenceIterator = sentenceIndex.iterator();
+ while (sentenceIterator.hasNext()) {
+ Sentence sentence = (Sentence) sentenceIterator.next();
+
+ tokenList.clear();
+ wordList.clear();
+
+ // iterate over Tokens
+ FSIterator tokenIterator = tokenIndex.subiterator(sentence);
+ while (tokenIterator.hasNext()) {
+ Token token = (Token) tokenIterator.next();
+
+ tokenList.add(token);
+ wordList.add(token.getCoveredText());
+ }
+
+ List wordTagList = tagger.tag(wordList);
+
+ try {
+ for (int i = 0; i < tokenList.size(); i++) {
+ Token token = (Token) tokenList.get(i);
+ String posTag = (String) wordTagList.get(i);
+ token.setPosTag(posTag);
}
+ } catch (IndexOutOfBoundsException e) {
+ System.err.println("POS tagger error - list of tags shorter than list of words");
+ }
}
+ }
}