diff --git a/.gitignore b/.gitignore
index 0777b1ce..5bf8edd3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,6 @@ common/bin/
lap/bin/
uima.log
+.metadata
+lap/src/null223365410
+.gitignore
diff --git a/alignmentedas/pom.xml b/alignmentedas/pom.xml
new file mode 100644
index 00000000..b2f9d456
--- /dev/null
+++ b/alignmentedas/pom.xml
@@ -0,0 +1,28 @@
+
+
+ 4.0.0
+
+ eu.excitementproject
+ eop
+ 1.1.4
+
+ alignmentedas
+ alignmentedas
+ http://maven.apache.org
+
+ UTF-8
+
+
+
+
+ eu.excitementproject
+ core
+ 1.1.4
+
+
+ eu.excitementproject
+ lap
+ 1.1.4
+
+
+
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/P1EdaRTERunner.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/P1EdaRTERunner.java
new file mode 100644
index 00000000..72d2de7f
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/P1EdaRTERunner.java
@@ -0,0 +1,126 @@
+package eu.excitementproject.eop.alignmentedas;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.uima.jcas.JCas;
+
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.TEDecisionWithAlignment;
+import eu.excitementproject.eop.alignmentedas.p1eda.instances.SimpleWordCoverageDE;
+import eu.excitementproject.eop.alignmentedas.p1eda.instances.SimpleWordCoverageEN;
+import eu.excitementproject.eop.alignmentedas.p1eda.instances.SimpleWordCoverageIT;
+import eu.excitementproject.eop.alignmentedas.p1eda.sandbox.WNVOMT;
+import eu.excitementproject.eop.alignmentedas.p1eda.sandbox.WithVO;
+import eu.excitementproject.eop.alignmentedas.p1eda.sandbox.WithoutVO;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.lap.LAPException;
+import eu.excitementproject.eop.lap.dkpro.TreeTaggerDE;
+import eu.excitementproject.eop.lap.dkpro.TreeTaggerEN;
+import eu.excitementproject.eop.lap.dkpro.TreeTaggerIT;
+import eu.excitementproject.eop.lap.implbase.LAP_ImplBase;
+
+/**
+ * A simple (EOP)-RTE XML data runner for P1EDA configurations
+ *
+ */
+@SuppressWarnings("unused")
+public class P1EdaRTERunner
+{
+ public static void main( String[] args )
+ {
+ BasicConfigurator.configure();
+ Logger.getRootLogger().setLevel(Level.INFO); // set INFO to hide Debug info.
+
+ try
+ {
+ // Prepare LAP and EDA (here, both for English) and eval on RTE3 (again, EN)
+ LAP_ImplBase lapEN = new TreeTaggerEN();
+ P1EDATemplate p1edaEN = new SimpleWordCoverageEN(); // Put your (configured, instance) P1EDA here...
+ evaluateOnRTE3EN(lapEN, p1edaEN, false); // set final argument true, if lap has not been changed from last call. (to reuse saved XMI files)
+
+ // use evaluateOnRTE3DE for German
+// LAP_ImplBase lapDE = new TreeTaggerDE();
+// P1EDATemplate p1edaDE = new SimpleWordCoverageDE();
+// evaluateOnRTE3DE(lapDE, p1edaDE, false);
+
+ // use evaluateOnRTE3IT for Italian
+// LAP_ImplBase lapIT = new TreeTaggerIT();
+// P1EDATemplate p1edaIT = new SimpleWordCoverageIT();
+// evaluateOnRTE3IT(lapIT, p1edaIT, false);
+
+ }
+ catch(Exception e)
+ {
+ System.err.println("Run stopped with an exception: " + e.getMessage());
+ }
+
+ }
+
+ public static void evaluateOnRTE3EN(LAP_ImplBase lap, P1EDATemplate p1eda, boolean isXmiAlreadyPreprocessed) throws LAPException, EDAException, IOException
+ {
+ File rteTrainingXML = new File("../core/src/main/resources/data-set/English_dev.xml");
+ File rteTestingXML = new File("../core/src/main/resources/data-set/English_test.xml");
+
+ evaluateOnRTEData(lap, p1eda, rteTrainingXML, rteTestingXML, isXmiAlreadyPreprocessed);
+ }
+
+ public static void evaluateOnRTE3DE(LAP_ImplBase lap, P1EDATemplate p1eda, boolean isXmiAlreadyPreprocessed) throws LAPException, EDAException, IOException
+ {
+ File rteTrainingXML = new File("../core/src/main/resources/data-set/German_dev.xml");
+ File rteTestingXML = new File("../core/src/main/resources/data-set/German_test.xml");
+
+ evaluateOnRTEData(lap, p1eda, rteTrainingXML, rteTestingXML, isXmiAlreadyPreprocessed);
+ }
+
+ public static void evaluateOnRTE3IT(LAP_ImplBase lap, P1EDATemplate p1eda, boolean isXmiAlreadyPreprocessed) throws LAPException, EDAException, IOException
+ {
+ File rteTrainingXML = new File("../core/src/main/resources/data-set/Italian_dev.xml");
+ File rteTestingXML = new File("../core/src/main/resources/data-set/Italian_test.xml");
+
+ evaluateOnRTEData(lap, p1eda, rteTrainingXML, rteTestingXML, isXmiAlreadyPreprocessed);
+ }
+
+ public static void evaluateOnRTEData(LAP_ImplBase lap, P1EDATemplate p1eda, File trainXML, File testXML, boolean xmiAlreadyPreprocessed) throws LAPException, EDAException, IOException
+ {
+ File trainXmiDir = new File("target/trainingXmis/");
+ File evalXmiDir = new File("target/testingXmis/");
+
+ if (!xmiAlreadyPreprocessed)
+ {
+ runLAPForXmis(lap, trainXML, trainXmiDir);
+ runLAPForXmis(lap, testXML, evalXmiDir);
+ }
+
+ // Train the instance, and save model.
+ //File classifierModel = new File ("target/cModel.model");
+ File classifierModel = new File (CLASSIFIER_MODEL_NAME);
+ p1eda.startTraining(trainXmiDir, classifierModel);
+
+ // evaluate with test(eval) data
+ List evalResult = p1eda.evaluateModelWithGoldXmis(evalXmiDir);
+
+ System.out.println("(accuracy, f1, prec, recall, true positive ratio, true negative ratio)");
+ System.out.println(evalResult.toString());
+ }
+
+ public static void runLAPForXmis(LAP_ImplBase lap, File rteInputXML, File xmiDir) throws LAPException, IOException
+ {
+
+ if (xmiDir.exists()) {
+ // delete all contents
+ FileUtils.deleteDirectory(xmiDir);
+ }
+ xmiDir.mkdirs();
+
+ lap.processRawInputFormat(rteInputXML, xmiDir);
+ }
+
+ static int unused;
+ static final String CLASSIFIER_MODEL_NAME = "target/temp.cmodel";
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/P1EDAFullTemplate.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/P1EDAFullTemplate.java
new file mode 100644
index 00000000..6fec54be
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/P1EDAFullTemplate.java
@@ -0,0 +1,660 @@
+/**
+ *
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.uimafit.util.JCasUtil;
+
+import eu.excitement.type.entailment.Pair;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.DecisionLabelWithConfidence;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.LabeledInstance;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.DecisionLabel;
+//import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDABasic;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.configuration.CommonConfig;
+import eu.excitementproject.eop.lap.LAPException;
+import eu.excitementproject.eop.lap.PlatformCASProber;
+import eu.excitementproject.eop.lap.implbase.LAP_ImplBase;
+import static eu.excitementproject.eop.lap.PlatformCASProber.probeCas;
+
+// WARNING --- A work in progress. don't try to run it yet.
+// TODO: Make this as an extension of P1EDASimpleTemplate (hmm.?)
+
+/**
+ * This is a template, abstract class for P1 EDA.
+ *
+ *
What this template class is for?
+ *
+ * It provides basic "flow" for process and training of alignment-based EDA.
+ * The template is an "abstract" class, and supposed to be extended to become
+ * an actual Entailment Decision Algorithm (EDA) class.
+ *
+ *
+ * The following two methods *must* be extended (override)
+ *
+ *
addAlignment()
+ *
evaluateAlignments()
+ *
+ *
+ *
+ * The following methods are optional to be extended (EDA can work and classify
+ * Entailment, even though they are not overridden). They provide optional capabilities.
+ *
+ *
+ *
TODO write
+ *
+ *
+ *
+ *
It is recommended to check actual example codes to see how you make
+ * an alignment-based EDA by extending this abstract class. Please check the following
+ * classes: {@link ClassName} TODO update
+ *
+ *
Classifier capability is embedded within the template
+ *
+ * Classification capability of this template is provided by using Weka
+ * classifier. Changing the classifier and option within Weka is simple:
+ * TODO change this, and this.
+ *
+ * If you want to use some other classifiers;
+ * TODO check and write this. (e.g. one with Rui's classifier)
+ *
+ * Please see the following document for more info:
+ * TODO fill in URL
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public abstract class P1EDAFullTemplate implements EDABasic {
+
+ /**
+ * The default, no argument constructor for this abstract class. Does nothing
+ * but initializing two mandatory final fields. They are: logger and classifier.
+ *
+ * This constructor does not set evaluateAlignmentParameters. (it will be set as null)
+ * If your evaluateAlignment override *does not* require parameters (e.g. simple feature
+ * extractors that does not require parameters); then using this constructor is enough.
+ * (evaluateAlignments() will be always called with null).
+ *
+ * For example, see SimpleWordCoverageP1EDA.
+ *
+ */
+ public P1EDAFullTemplate() throws EDAException
+ {
+ this(null);
+ }
+
+
+ /**
+ *
+ * The main constructor for this abstract class.
+ *
+ * It does two things: initializing logger + classifier, and store Parameter value
+ *
+ * The constructor gets one Vector of parameters: This parameter vector is so called
+ * "Feature Extractor parameters" or "Evaluate Alignment parameters" -- and the value
+ * will be passed to evaluateAlignments().
+ *
+ * If your evaluateAlignment override *require* parameters (e.g. weights for each
+ * aligner, etc), then you have to use this constructor.
+ *
+ * @param evaluateAlignmentParameter
+ * @throws EDAException
+ */
+ public P1EDAFullTemplate(Vector evaluateAlignmentParameter) throws EDAException
+ {
+ this.logger = Logger.getLogger(getClass());
+ this.classifier = prepareClassifier();
+ this.evaluateAlignmentParameters = evaluateAlignmentParameter;
+ }
+
+ public TEDecisionWithAlignment process(JCas eopJCas) throws EDAException
+ {
+ // Here's the basic step of P1 EDA's process(), outlined by the template.
+ // Note that, the template assumes that you override each of the step-methods.
+ // (although you are free to override any, including this process()).
+
+ logger.debug("process() has been called with CAS " + eopJCas);
+
+ // Step 0. check JCas: a correct one with all needed annotations?
+ checkInputJCas(eopJCas);
+ String pairID = getTEPairID(eopJCas);
+ logger.info("processing pair with ID: " + pairID);
+
+ // Step 1. add alignments. The method will add various alignment.Link instances
+ // Once this step is properly called, the JCas holds alignment.Link data in it.
+ logger.debug("calling addAlignments");
+ addAlignments(eopJCas);
+
+ // Step 2. (this is an optional step.) The method will interact / output
+ // the added alignment links for debug / analysis purpose. (for Tracer)
+ logger.debug("calling visualizeAlignments");
+ visualizeAlignments(eopJCas);
+
+ // Step 3.
+ logger.debug("calling evaluateAlignments");
+ Vector featureValues = evaluateAlignments(eopJCas, evaluateAlignmentParameters);
+ logger.debug("evaluateAlignments returned feature vector as of; ");
+ logger.debug(featureValues.toString());
+
+ // Step 4. (this is also an optional step.)
+ logger.debug("calling evaluateAlignments");
+ visualizeEdaInternals();
+
+ // Step 5.
+ // Classification.
+ logger.debug("calling classifyEntailment");
+ DecisionLabelWithConfidence result = classifyEntailment(featureValues);
+
+ // Finally, return a TEDecision object with CAS (which holds alignments)
+ logger.debug("TEDecision object generated and being returned: " + result.getLabel() + ", " + result.getConfidence());
+ return new TEDecisionWithAlignment(result.getLabel(), result.getConfidence(), pairID, eopJCas);
+ }
+
+ public void initialize(CommonConfig conf) throws EDAException
+ {
+ // TODO read from common config table, and call argument version
+ }
+
+ public void initialize(File modelToLoadBaseName) throws EDAException
+ {
+ File classifierModelFile = new File(modelToLoadBaseName.getAbsolutePath() + CLASSIFIER_MODEL_POSTFIX);
+ File paramSerFile = new File(modelToLoadBaseName.getAbsolutePath() + PARAMETER_SER_POSTFIX);
+
+ try
+ {
+ classifier.loadClassifierModel(classifierModelFile);
+ loadEDAStates(paramSerFile);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Loading classifier model and/or parameter failed: ", ce);
+ }
+ }
+
+ public void startTraining(CommonConfig conf)
+ {
+ // TODO read from common config, and call argument version,
+ }
+
+
+ // TODO: for parameter optimization. Once parameter optimization comes in,
+ // training-sub methods will be provided.
+ // "Training Classifier"
+ // "Train Classifier With Parameter Optimizations"
+
+ public void startTraining(File dirTrainingDataXMIFiles, File modelToStoreBaseName) throws EDAException
+ {
+
+ // This work method will read Xmi files and convert them to labeled feature vectors
+ // what we call as "LabeledInstance":
+ // The method does so, by calling "addAlignments", "evaluateAlignments" on
+ // each of the annotated training(gold) data.
+ List trainingSet = makeLabeledInstancesFromXmiFiles(dirTrainingDataXMIFiles);
+
+ // finally, calling classifier abstract to train a model
+ try
+ {
+ classifier.createClassifierModel(trainingSet);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Underlying classifier thrown exception while training a model", ce);
+ }
+
+ // and store the model and parameters
+ try
+ {
+ classifier.storeClassifierModel(new File(modelToStoreBaseName.getAbsolutePath() + CLASSIFIER_MODEL_POSTFIX));
+ this.storeEDAStates(new File(modelToStoreBaseName.getAbsolutePath() + PARAMETER_SER_POSTFIX));
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Underlying classifier thrown exception while deserializing a model", ce);
+ }
+ }
+
+ /**
+ * A method to be used for evaluation. The method reads XMI files (with labels) and
+ * use the current model (loaded or trained) and evaluate it over the give XMI files.
+ *
+ * returns a List of double values. They are: (accuracy, f1, prec, recall, true positive ratio, true negative ratio)
+ *
+ * TODO: CONSIDER: this needs to be broken down into two methods.... or not?
+ * (decision - for now, as is)
+ *
+ * Hmm. Let's say, what is the common step in "optimize"
+ *
+ * [PRE]
+ * 1) Load XMIS (ONCE)
+ * 2) Add alignments (also ONCE)
+ *
+ * [MAIN-LOOP] while exploring (search) best parameters (parameter population, one individual parameter)
+ * 3) Make a list of labeled instances, with one-individual parameter, and calling evaluateAlignments (MULTIPLE TIMES)
+ * 4) Train a model with the set, evaluate it.
+ *
+ * [POST]
+ * 5) report the best result, with best individual parameter
+ *
+ * Okay, can we reuse, share more from the above? (maybe not. let's worry later. This method itself is almost free.)
+ *
+ * @return a double list: (accuracy, f1, prec, recall, true positive ratio, true negative ratio)
+
+ */
+ public List evaluateModelWithGoldXmis(File annotatedXmiFiles) throws EDAException
+ {
+ // read annotatedXmiFiles, and make a set of labeled instances,
+ // by calling the utility method (the same one used in startTraining())
+ List goldData = makeLabeledInstancesFromXmiFiles(annotatedXmiFiles);
+
+
+ // ask the classifier to evaluate it (with current loaded/trained model) on the provided labeled data
+ List evaluationResult = null;
+ try {
+ evaluationResult = classifier.evaluateClassifier(goldData);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException ("The classifier was not ready for evalute (make sure a compatible model properly trained and loaded..)", ce);
+ }
+
+ return evaluationResult;
+ }
+
+ public void shutdown()
+ {
+ // This template itself has nothing to close down.
+ }
+
+
+ /*
+ * Mandatory methods (steps) that should be overridden.
+ */
+
+ /**
+ * @param input
+ * @throws EDAException
+ */
+ protected abstract void addAlignments(JCas input) throws EDAException;
+
+ /**
+ * @param aJCas
+ * @return
+ * @throws EDAException
+ */
+ protected abstract Vector evaluateAlignments(JCas aJCas, Vector featureExtractorParameters) throws EDAException;
+
+
+// /**
+// *
+// * @return
+// */
+// protected abstract Vector prepareEvaluateAlignmentParameters();
+
+
+ /*
+ * Optional methods (steps) that can be overridden.
+ */
+
+ protected void visualizeAlignments(JCas CASWithAlignments)
+ {
+ // Template default is doing nothing.
+ }
+
+ protected void visualizeEdaInternals()
+ {
+ // Template default is doing nothing.
+ }
+
+ /**
+ * Optional methods (steps) that can be overridden. --- but these
+ * methods provide default functionalities. You can extend if you want.
+ * But default implementations would also work as well.
+ */
+
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka();
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ /**
+ * The method stores EDA-level states and parameters that are set via training to
+ * a File, so that can be restored when initializing a new EDA instance.
+ *
+ * This method is called within the training step (startTraining()) of the EDA.
+ *
+ * If you add some additional "internal parameters" (or states) that can affect
+ * EDA (e.g. things that would affect addAlignments(), evaluateAlignments() and so on.)
+ * You will also need to save them, in addition to default EDAStates which are defined
+ * in the methods. Override this method if you have such a case.
+ *
+ * @param paramSerFile
+ * @throws EDAException
+ */
+ protected void storeEDAStates(File paramSerFile) throws EDAException
+ {
+ ArrayList> twoParamVectors = new ArrayList>();
+ twoParamVectors.add(evaluateAlignmentParameters);
+ twoParamVectors.add(internalParameters);
+
+ try
+ {
+ FileOutputStream os = new FileOutputStream(paramSerFile);
+ ObjectOutputStream out = new ObjectOutputStream(os);
+ out.writeObject(twoParamVectors);
+ out.close();
+ os.close();
+ logger.info("Parameters stored in " + paramSerFile.getName());
+ }
+ catch(IOException io)
+ {
+ throw new EDAException("IO operation to store / serialize parameters failed", io);
+ }
+ }
+ /**
+ * The method loads EDA-level states and parameters from a file, that has been
+ * stored in previous training run.
+ *
+ * This method is called within the initialization step (initialize()) of the EDA.
+ * (Roughly the same instance when it loads Classifier model)
+ *
+ * If you add some additional "internal parameters" (or states) that can affect
+ * EDA (e.g. things that would affect addAlignments(), evaluateAlignments() and so on.)
+ * You will also need to save (after training) and load (when init) them,
+ * in addition to default EDAStates which are defined in the methods.
+ * Override this method if you have such a case.
+ *
+ * @param paramSerFile
+ * @throws EDAException
+ */
+
+ protected void loadEDAStates(File paramSerFile) throws EDAException
+ {
+ if (!paramSerFile.exists())
+ {
+ throw new EDAException("File not found: "+ paramSerFile.getAbsolutePath());
+ }
+ try
+ {
+ FileInputStream is = new FileInputStream(paramSerFile);
+ ObjectInputStream in = new ObjectInputStream(is);
+ @SuppressWarnings("unchecked")
+ ArrayList> twoParamVectors = (ArrayList>) in.readObject();
+ in.close();
+ is.close();
+ evaluateAlignmentParameters = twoParamVectors.get(0);
+ internalParameters = twoParamVectors.get(1);
+ }
+ catch(IOException i)
+ {
+ throw new EDAException("Reading and deserilaizing the file failed: "+ paramSerFile.getAbsolutePath(), i);
+ }
+ catch(ClassNotFoundException c)
+ {
+ throw new EDAException("Integrity failure --- serialization file is of an unknown class type that is not parameters "+ paramSerFile.getAbsolutePath(), c);
+ }
+ }
+
+
+ /**
+ * This method will be used to check input CAS for P1EDA flow.
+ * As is, it will do the basic check of CAS as EOP CAS input, via PlatformCASProber.probeCAS().
+ *
+ * If you want to do additional checks, such as existence of specific LAP annotations,
+ * You can extend this class to do the checks.
+ *
+ * EXTENSION of this method is optional, and not mandatory.
+ *
+ * @param input JCas that is given to your EDA
+ * @throws EDAException If the given JCas was not well-formed for your EDA, you should throw this exception
+ */
+ protected void checkInputJCas(JCas input) throws EDAException
+ {
+ try {
+ probeCas(input, null);
+ }
+ catch (LAPException e)
+ {
+ throw new EDAException("Input CAS is not well-formed CAS as EOP EDA input.", e);
+ }
+ }
+
+ protected DecisionLabelWithConfidence classifyEntailment(Vector fValues) throws EDAException
+ {
+ DecisionLabelWithConfidence dl = null;
+ try {
+ dl = classifier.classifyInstance(fValues);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("underlying classifier throw exception", ce);
+ }
+
+ return dl;
+ }
+
+ //
+ // utility methods
+
+ protected List makeLabeledInstancesFromXmiFiles(File xmiDir) throws EDAException
+ {
+ List labeledData = new ArrayList();
+
+ // walk each XMI files in the Directory ...
+ File[] files = xmiDir.listFiles();
+ if (files == null)
+ {
+ throw new EDAException("Path " + xmiDir.getAbsolutePath() + " does not hold XMI files");
+ }
+
+ for (File f : files)
+ {
+ // is it a XMI file?
+ //
+ logger.info("Working with file " + f.getName());
+ if(!f.isFile())
+ { // no ...
+ logger.warn(f.toString() + " is not a file... ignore this");
+ continue;
+ }
+ if(!f.getName().toLowerCase().endsWith("xmi")) // let's trust name, if it does not end with XMI, pass
+ {
+ logger.warn(f.toString() + " is not a XMI file... ignoring this");
+ continue;
+ }
+
+ // So, we have an XMI file. Load in to CAS
+ JCas aTrainingPair = null;
+ try {
+ aTrainingPair = PlatformCASProber.probeXmi(f, null);
+ }
+ catch (LAPException le)
+ {
+ logger.warn("File " + f.toString() + " looks like XMI file, but its contents are *not* proper EOP EDA JCas");
+ throw new EDAException("failed to read XMI file into a JCas", le);
+ }
+ String pairID = getTEPairID(aTrainingPair);
+ logger.info("processing pair with ID: " + pairID);
+
+ // convert it into one LabeledInstance by calling
+ // addAlignments and evaluateAlignments on each of them
+ logger.debug("adding alignments...");
+ addAlignments(aTrainingPair);
+
+ logger.debug("evaluating alignments...");
+ Vector fv = evaluateAlignments(aTrainingPair, evaluateAlignmentParameters);
+ DecisionLabel l = getGoldLabel(aTrainingPair);
+ if (l == null)
+ {
+ throw new EDAException("Gold data has been given to be used as a Labeled Instance: However, the CAS holds no Gold Label!");
+ }
+
+ LabeledInstance ins = new LabeledInstance(l, fv);
+
+ logger.debug("a labeled instance has been generated from XMI file " + f.getName());
+ logger.debug(fv.toString() + ", " + l.toString());
+ labeledData.add(ins);
+ }
+
+ return labeledData;
+ }
+
+
+
+ /**
+ *
+ * Get Pair ID from a JCas
+ *
+ * @param aJCas
+ * @return
+ * @throws EDAException
+ */
+ protected String getTEPairID(JCas aJCas) throws EDAException
+ {
+ String id = null;
+
+ // check entailment pair,
+ FSIterator iter = aJCas.getJFSIndexRepository().getAllIndexedFS(Pair.type);
+ if (iter.hasNext())
+ {
+ Pair p = (Pair) iter.next();
+ id = p.getPairID();
+
+ if (iter.hasNext())
+ {
+ logger.warn("This JCas has more than one TE Pairs: This P1EDA template only processes single-pair inputs. Any additional pairs are being ignored, and only the first Pair will be processed.");
+ }
+ return id;
+ }
+ else
+ {
+ throw new EDAException("Input CAS is not well-formed CAS as EOP EDA input: missing TE pair");
+ }
+ }
+
+ /**
+ * get Gold Label from an annotated JCas with Entailment.Pair
+ *
+ * @param aJCas
+ * @return
+ * @throws EDAException
+ */
+ protected DecisionLabel getGoldLabel(JCas aJCas) throws EDAException
+ {
+ String labelString;
+ DecisionLabel labelEnum;
+
+ FSIterator iter = aJCas.getJFSIndexRepository().getAllIndexedFS(Pair.type);
+ if (iter.hasNext())
+ {
+ Pair p = (Pair) iter.next();
+ labelString = p.getGoldAnswer();
+
+ if (labelString == null) // there is no gold answer annotated in this Pair
+ return null;
+
+ labelEnum = DecisionLabel.getLabelFor(labelString);
+
+ if (iter.hasNext())
+ {
+ logger.warn("This JCas has more than one TE Pairs: This P1EDA template only processes single-pair inputs. Any additional pairs are being ignored, and only the first Pair will be processed.");
+ }
+ return labelEnum;
+ }
+ else
+ {
+ throw new EDAException("Input CAS is not well-formed CAS as EOP EDA input: missing TE pair");
+ }
+ }
+
+ /**
+ * A check utility method.
+ * A static utility method for checking, if or not, the CAS has a specific
+ * type of annotation instances, or not.
+ *
+ * e.g. haveCASAnnotationType(aJCas,
+ *
+ * @param aJCas
+ * @param annot
+ * @return
+ */
+ protected static boolean haveCASAnnotationType(JCas aJCas, Class type) throws CASException
+ {
+ // returns false, if both of the views do not have the requested type.
+ JCas hypoView = aJCas.getView(LAP_ImplBase.HYPOTHESISVIEW);
+
+ if (JCasUtil.select(hypoView, type).size() > 0)
+ return true;
+
+ JCas textView = aJCas.getView(LAP_ImplBase.TEXTVIEW);
+
+ if (JCasUtil.select(textView, type).size() > 0)
+ return true;
+
+ return false;
+ }
+
+
+
+ /**
+ * This is the vector of parameters, that will be stored at the init time
+ * (at initialize() for processing, and start_training() time for training) and
+ * that will be passed to internal method evaluateAlignments().
+ *
+ * Within this P1EDA Template, this value is a fixed value, where it is set as
+ * a configuration. For "Optimizing" this value ... TODO see this extended template
+ *
+ */
+ protected Vector evaluateAlignmentParameters;
+
+
+ /**
+ * This is a vector of parameters, that has been "trained" in one startTraining() session.
+ * This is internal parameters that and external "parameter" optimizer
+ *
+ */
+ protected Vector internalParameters = null;
+
+
+
+
+ //
+ // private final fields...
+ //
+ private final EDAClassifierAbstraction classifier;
+ protected final Logger logger;
+
+ // some constants
+ public final String CLASSIFIER_MODEL_POSTFIX = ".classifier.model";
+ public final String PARAMETER_SER_POSTFIX = ".parameters.ser";
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/P1EDATemplate.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/P1EDATemplate.java
new file mode 100644
index 00000000..71301977
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/P1EDATemplate.java
@@ -0,0 +1,616 @@
+/**
+ *
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda;
+
+import java.io.File;
+//import java.io.FileInputStream;
+//import java.io.FileOutputStream;
+//import java.io.IOException;
+//import java.io.ObjectInputStream;
+//import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.uimafit.util.JCasUtil;
+
+import eu.excitement.type.entailment.Pair;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.DecisionLabelWithConfidence;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.LabeledInstance;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.DecisionLabel;
+//import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDABasic;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.configuration.CommonConfig;
+import eu.excitementproject.eop.common.configuration.NameValueTable;
+import eu.excitementproject.eop.common.exception.ConfigurationException;
+import eu.excitementproject.eop.lap.LAPException;
+import eu.excitementproject.eop.lap.PlatformCASProber;
+import eu.excitementproject.eop.lap.implbase.LAP_ImplBase;
+import static eu.excitementproject.eop.lap.PlatformCASProber.probeCas;
+
+/**
+ * This is a template, abstract class for P1 EDA.
+ *
+ *
What this template class is for?
+ *
+ * It provides basic "flow" for process and training of alignment-based EDA.
+ * The template is an "abstract" class, and supposed to be extended to become
+ * an actual Entailment Decision Algorithm (EDA) class.
+ *
+ *
+ * The following two methods *must* be extended (override)
+ *
+ *
addAlignment()
+ *
evaluateAlignments()
+ *
+ *
+ *
+ * The following methods are optional to be extended (EDA can work and classify
+ * Entailment, even though they are not overridden). They provide optional capabilities.
+ *
+ *
+ *
TODO write
+ *
+ *
+ *
+ *
It is recommended to check actual example codes to see how you make
+ * an alignment-based EDA by extending this abstract class. Please check the following
+ * classes: {@link ClassName} TODO update
+ *
+ *
Classifier capability is embedded within the template
+ *
+ * Classification capability of this template is provided by using Weka
+ * classifier. Changing the classifier and option within Weka is simple:
+ * TODO change this, and this.
+ *
+ * If you want to use some other classifiers;
+ * TODO check and write this. (e.g. one with Rui's classifier)
+ *
+ * Please see the following document for more info:
+ * TODO fill in URL
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+
+public abstract class P1EDATemplate implements EDABasic {
+
+ /**
+ * the language
+ */
+ protected String language;
+
+ /**
+ * the training data directory
+ */
+ protected String trainDIR = null;
+
+ /**
+ * the test data directory
+ */
+ protected String testDIR = null;
+
+
+ /**
+ * the model file
+ */
+ protected String modelFile = null;
+
+ /**
+ * The default, no argument constructor for this abstract class. Does nothing
+ * but initializing two mandatory final fields. They are: logger and classifier.
+ *
+ * This constructor does not set evaluateAlignmentParameters. (it will be set as null)
+ * If your evaluateAlignment override *does not* require parameters (e.g. simple feature
+ * extractors that does not require parameters); then using this constructor is enough.
+ * (evaluateAlignments() will be always called with null).
+ *
+ * For example, see SimpleWordCoverageP1EDA.
+ *
+ */
+ public P1EDATemplate() throws EDAException
+ {
+ this(null);
+ }
+
+
+ /**
+ *
+ * The main constructor for this abstract class.
+ *
+ * It does two things: initializing logger + classifier, and store Parameter value
+ *
+ * The constructor gets one Vector of parameters: This parameter vector is so called
+ * "Feature Extractor parameters" or "Evaluate Alignment parameters" -- and the value
+ * will be passed to evaluateAlignments().
+ *
+ * If your evaluateAlignment override *require* parameters (e.g. weights for each
+ * aligner, etc), then you have to use this constructor.
+ *
+ * @param evaluateAlignmentParameter
+ * @throws EDAException
+ */
+ public P1EDATemplate(Vector evaluateAlignmentParameter) throws EDAException
+ {
+ this.logger = Logger.getLogger(getClass());
+ this.classifier = prepareClassifier();
+ this.evaluateAlignmentParameters = evaluateAlignmentParameter;
+ }
+
+ public TEDecisionWithAlignment process(JCas eopJCas) throws EDAException
+ {
+ // Here's the basic step of P1 EDA's process(), outlined by the template.
+ // Note that, the template assumes that you override each of the step-methods.
+ // (although you are free to override any, including this process()).
+
+ logger.debug("process() has been called with CAS " + eopJCas);
+
+ // Step 0. check JCas: a correct one with all needed annotations?
+ checkInputJCas(eopJCas);
+ String pairID = getTEPairID(eopJCas);
+ logger.info("processing pair with ID: " + pairID);
+
+ // Step 1. add alignments. The method will add various alignment.Link instances
+ // Once this step is properly called, the JCas holds alignment.Link data in it.
+ logger.debug("calling addAlignments");
+ addAlignments(eopJCas);
+
+ // Step 2. (this is an optional step.) The method will interact / output
+ // the added alignment links for debug / analysis purpose. (for Tracer)
+ logger.debug("calling visualizeAlignments");
+ visualizeAlignments(eopJCas);
+
+ // Step 3.
+ logger.debug("calling evaluateAlignments");
+ Vector featureValues = evaluateAlignments(eopJCas, evaluateAlignmentParameters);
+ logger.debug("evaluateAlignments returned feature vector as of; ");
+ logger.debug(featureValues.toString());
+
+ // Step 4. (this is also an optional step.)
+ logger.debug("calling evaluateAlignments");
+ visualizeEdaInternals();
+
+ // Step 5.
+ // Classification.
+ logger.debug("calling classifyEntailment");
+ DecisionLabelWithConfidence result = classifyEntailment(featureValues);
+
+ // Finally, return a TEDecision object with CAS (which holds alignments)
+ logger.debug("TEDecision object generated and being returned: " + result.getLabel() + ", " + result.getConfidence());
+ return new TEDecisionWithAlignment(result.getLabel(), result.getConfidence(), pairID, eopJCas);
+ }
+
+ public void initialize(CommonConfig conf) throws EDAException
+ {
+
+ NameValueTable nameValueTable;
+ try {
+ nameValueTable = conf.getSection(this.getClass().getCanonicalName());
+ File modelFile = nameValueTable.getFile("modelFile");
+ initialize(modelFile);
+ } catch (ConfigurationException e) {
+ throw new EDAException ("Reading configuration data failed: " + e.getMessage(), e);
+ }
+ }
+
+ public void initialize(File classifierModelFile) throws EDAException
+ {
+ try
+ {
+ classifier.loadClassifierModel(classifierModelFile);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Loading classifier model and/or parameter failed: ", ce);
+ }
+ }
+
+ public void startTraining(CommonConfig conf) throws EDAException
+ {
+ // read from common config, and call argument version,
+ NameValueTable nameValueTable;
+ try {
+ nameValueTable = conf.getSection(this.getClass().getCanonicalName());
+
+ File trainDir = nameValueTable.getFile("trainDir");
+ File modelFileToCreate = nameValueTable.getFile("modelFile");
+
+ startTraining(trainDir, modelFileToCreate);
+ } catch (ConfigurationException ce) {
+ throw new EDAException("Reading configuration from CommonConfig failed: " + ce.getMessage(), ce);
+ }
+ }
+
+
+ // TODO: for parameter optimization. Once parameter optimization comes in,
+ // training-sub methods will be provided.
+ // "Training Classifier"
+ // "Train Classifier With Parameter Optimizations"
+
+ public void startTraining(File dirTrainingDataXMIFiles, File classifierModelToStore) throws EDAException
+ {
+
+ // This work method will read Xmi files and convert them to labeled feature vectors
+ // what we call as "LabeledInstance":
+ // The method does so, by calling "addAlignments", "evaluateAlignments" on
+ // each of the annotated training(gold) data.
+
+
+ List trainingSet = makeLabeledInstancesFromXmiFiles(dirTrainingDataXMIFiles);
+
+ // finally, calling classifier abstract to train a model
+ try
+ {
+ classifier.createClassifierModel(trainingSet);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Underlying classifier thrown exception while training a model", ce);
+ }
+
+ // and store the model and parameters
+ try
+ {
+ classifier.storeClassifierModel(classifierModelToStore);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Underlying classifier thrown exception while deserializing a model", ce);
+ }
+ }
+
+ /**
+ * A method to be used for evaluation. The method reads XMI files (with labels) and
+ * use the current model (loaded or trained) and evaluate it over the give XMI files.
+ *
+ * returns a List of double values. They are: (accuracy, f1, prec, recall, true positive ratio, true negative ratio)
+ *
+ * TODO: CONSIDER: this needs to be broken down into two methods.... or not?
+ * (decision - for now, as is)
+ *
+ * Hmm. Let's say, what is the common step in "optimize"
+ *
+ * [PRE]
+ * 1) Load XMIS (ONCE)
+ * 2) Add alignments (also ONCE)
+ *
+ * [MAIN-LOOP] while exploring (search) best parameters (parameter population, one individual parameter)
+ * 3) Make a list of labeled instances, with one-individual parameter, and calling evaluateAlignments (MULTIPLE TIMES)
+ * 4) Train a model with the set, evaluate it.
+ *
+ * [POST]
+ * 5) report the best result, with best individual parameter
+ *
+ * Okay, can we reuse, share more from the above? (maybe not. let's worry later. This method itself is almost free.)
+ *
+ * @return a double list: (accuracy, f1, prec, recall, true positive ratio, true negative ratio)
+
+ */
+ public List evaluateModelWithGoldXmis(File annotatedXmiFiles) throws EDAException
+ {
+ // read annotatedXmiFiles, and make a set of labeled instances,
+ // by calling the utility method (the same one used in startTraining())
+ List goldData = makeLabeledInstancesFromXmiFiles(annotatedXmiFiles);
+
+
+ // ask the classifier to evaluate it (with current loaded/trained model) on the provided labeled data
+ List evaluationResult = null;
+ try {
+ evaluationResult = classifier.evaluateClassifier(goldData);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException ("The classifier was not ready for evalute (make sure a compatible model properly trained and loaded..)", ce);
+ }
+
+ return evaluationResult;
+ }
+
+ public void shutdown()
+ {
+ // This template itself has nothing to close down.
+ }
+
+
+ /*
+ * Mandatory methods (steps) that should be overridden.
+ */
+
+ /**
+ * @param input
+ * @throws EDAException
+ */
+ protected abstract void addAlignments(JCas input) throws EDAException;
+
+ /**
+ * @param aJCas
+ * @return
+ * @throws EDAException
+ */
+ protected abstract Vector evaluateAlignments(JCas aJCas, Vector featureExtractorParameters) throws EDAException;
+
+
+// /**
+// *
+// * @return
+// */
+// protected abstract Vector prepareEvaluateAlignmentParameters();
+
+
+ /*
+ * Optional methods (steps) that can be overridden.
+ */
+
+ protected void visualizeAlignments(JCas CASWithAlignments)
+ {
+ // Template default is doing nothing.
+ }
+
+ protected void visualizeEdaInternals()
+ {
+ // Template default is doing nothing.
+ }
+
+ /**
+ * Optional methods (steps) that can be overridden. --- but these
+ * methods provide default functionalities. You can extend if you want.
+ * But default implementations would also work as well.
+ */
+
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka();
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+ /**
+ * This method will be used to check input CAS for P1EDA flow.
+ * As is, it will do the basic check of CAS as EOP CAS input, via PlatformCASProber.probeCAS().
+ *
+ * If you want to do additional checks, such as existence of specific LAP annotations,
+ * You can extend this class to do the checks.
+ *
+ * EXTENSION of this method is optional, and not mandatory.
+ *
+ * @param input JCas that is given to your EDA
+ * @throws EDAException If the given JCas was not well-formed for your EDA, you should throw this exception
+ */
+ protected void checkInputJCas(JCas input) throws EDAException
+ {
+ try {
+ probeCas(input, null);
+ }
+ catch (LAPException e)
+ {
+ throw new EDAException("Input CAS is not well-formed CAS as EOP EDA input.", e);
+ }
+ }
+
+ protected DecisionLabelWithConfidence classifyEntailment(Vector fValues) throws EDAException
+ {
+ DecisionLabelWithConfidence dl = null;
+ try {
+ dl = classifier.classifyInstance(fValues);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("underlying classifier throw exception", ce);
+ }
+
+ return dl;
+ }
+
+ //
+ // utility methods
+
+ protected List makeLabeledInstancesFromXmiFiles(File xmiDir) throws EDAException
+ {
+ List labeledData = new ArrayList();
+
+ // walk each XMI files in the Directory ...
+ File[] files = xmiDir.listFiles();
+ if (files == null)
+ {
+ throw new EDAException("Path " + xmiDir.getAbsolutePath() + " does not hold XMI files");
+ }
+ Arrays.sort(files);
+
+ for (File f : files)
+ {
+ // is it a XMI file?
+ //
+ logger.info("Working with file " + f.getName());
+ if(!f.isFile())
+ { // no ...
+ logger.warn(f.toString() + " is not a file... ignore this");
+ continue;
+ }
+ if(!f.getName().toLowerCase().endsWith("xmi")) // let's trust name, if it does not end with XMI, pass
+ {
+ logger.warn(f.toString() + " is not a XMI file... ignoring this");
+ continue;
+ }
+
+ // So, we have an XMI file. Load in to CAS
+ JCas aTrainingPair = null;
+ try {
+ aTrainingPair = PlatformCASProber.probeXmi(f, null);
+ }
+ catch (LAPException le)
+ {
+ logger.warn("File " + f.toString() + " looks like XMI file, but its contents are *not* proper EOP EDA JCas");
+ throw new EDAException("failed to read XMI file into a JCas", le);
+ }
+ String pairID = getTEPairID(aTrainingPair);
+ logger.info("processing pair with ID: " + pairID);
+
+ // convert it into one LabeledInstance by calling
+ // addAlignments and evaluateAlignments on each of them
+ logger.debug("adding alignments...");
+ addAlignments(aTrainingPair);
+
+ logger.debug("evaluating alignments...");
+ Vector fv = evaluateAlignments(aTrainingPair, evaluateAlignmentParameters);
+ DecisionLabel l = getGoldLabel(aTrainingPair);
+ if (l == null)
+ {
+ throw new EDAException("Gold data has been given to be used as a Labeled Instance: However, the CAS holds no Gold Label!");
+ }
+
+ LabeledInstance ins = new LabeledInstance(l, fv);
+
+ logger.debug("a labeled instance has been generated from XMI file " + f.getName());
+ logger.debug(fv.toString() + ", " + l.toString());
+ labeledData.add(ins);
+ }
+
+ return labeledData;
+ }
+
+
+
+ /**
+ *
+ * Get Pair ID from a JCas
+ *
+ * @param aJCas
+ * @return
+ * @throws EDAException
+ */
+ protected String getTEPairID(JCas aJCas) throws EDAException
+ {
+ String id = null;
+
+ // check entailment pair,
+ FSIterator iter = aJCas.getJFSIndexRepository().getAllIndexedFS(Pair.type);
+ if (iter.hasNext())
+ {
+ Pair p = (Pair) iter.next();
+ id = p.getPairID();
+
+ if (iter.hasNext())
+ {
+ logger.warn("This JCas has more than one TE Pairs: This P1EDA template only processes single-pair inputs. Any additional pairs are being ignored, and only the first Pair will be processed.");
+ }
+ return id;
+ }
+ else
+ {
+ throw new EDAException("Input CAS is not well-formed CAS as EOP EDA input: missing TE pair");
+ }
+ }
+
+ /**
+ * get Gold Label from an annotated JCas with Entailment.Pair
+ *
+ * @param aJCas
+ * @return
+ * @throws EDAException
+ */
+ protected DecisionLabel getGoldLabel(JCas aJCas) throws EDAException
+ {
+ String labelString;
+ DecisionLabel labelEnum;
+
+ FSIterator iter = aJCas.getJFSIndexRepository().getAllIndexedFS(Pair.type);
+ if (iter.hasNext())
+ {
+ Pair p = (Pair) iter.next();
+ labelString = p.getGoldAnswer();
+
+ if (labelString == null) // there is no gold answer annotated in this Pair
+ return null;
+
+ labelEnum = DecisionLabel.getLabelFor(labelString);
+
+ if (iter.hasNext())
+ {
+ logger.warn("This JCas has more than one TE Pairs: This P1EDA template only processes single-pair inputs. Any additional pairs are being ignored, and only the first Pair will be processed.");
+ }
+ return labelEnum;
+ }
+ else
+ {
+ throw new EDAException("Input CAS is not well-formed CAS as EOP EDA input: missing TE pair");
+ }
+ }
+
+ /**
+ * A check utility method.
+ * A static utility method for checking, if or not, the CAS has a specific
+ * type of annotation instances, or not.
+ *
+ * e.g. haveCASAnnotationType(aJCas,
+ *
+ * @param aJCas
+ * @param annot
+ * @return
+ */
+ protected static boolean haveCASAnnotationType(JCas aJCas, Class type) throws CASException
+ {
+ // returns false, if both of the views do not have the requested type.
+ JCas hypoView = aJCas.getView(LAP_ImplBase.HYPOTHESISVIEW);
+
+ if (JCasUtil.select(hypoView, type).size() > 0)
+ return true;
+
+ JCas textView = aJCas.getView(LAP_ImplBase.TEXTVIEW);
+
+ if (JCasUtil.select(textView, type).size() > 0)
+ return true;
+
+ return false;
+ }
+
+
+
+ /**
+ * This is the vector of parameters, that will be stored at the init time
+ * (at initialize() for processing, and start_training() time for training) and
+ * that will be passed to internal method evaluateAlignments().
+ *
+ * Within this P1EDA Template, this value is a fixed value, where it is set as
+ * a configuration. For "Optimizing" this value ... TODO see this extended template
+ *
+ */
+ protected Vector evaluateAlignmentParameters;
+
+
+ /**
+ * This is a vector of parameters, that has been "trained" in one startTraining() session.
+ * This is internal parameters that and external "parameter" optimizer
+ *
+ */
+ protected Vector internalParameters = null;
+
+ //
+ // private final fields...
+ //
+ private final EDAClassifierAbstraction classifier;
+ protected final Logger logger;
+
+ // some constants
+// public final String CLASSIFIER_MODEL_POSTFIX = ".classifier.model";
+// public final String PARAMETER_SER_POSTFIX = ".parameters.ser";
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/TEDecisionWithAlignment.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/TEDecisionWithAlignment.java
new file mode 100644
index 00000000..4acd61c8
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/TEDecisionWithAlignment.java
@@ -0,0 +1,60 @@
+package eu.excitementproject.eop.alignmentedas.p1eda;
+
+import org.apache.uima.jcas.JCas;
+
+import eu.excitementproject.eop.common.DecisionLabel;
+import eu.excitementproject.eop.common.TEDecision;
+
+/**
+ * A TEDecision implementation that holds the additional information for
+ * alignment. The alignment data can be accessed by get the underlying JCas
+ * that holds the alignments, which were used by the (alignment based) EDA
+ * to make the entailment decision.
+ *
+ * The method that has been added for this alignment data is getJCasWithAlignment().
+ * It returns the underlying JCas, and all its data (including alignment data) can be
+ * accessed as normal JCas data.
+ *
+ * @author Tae-Gil Noh
+ * @since July 2014
+ */
+public class TEDecisionWithAlignment implements TEDecision {
+
+ public TEDecisionWithAlignment(DecisionLabel label, Double confidence, String pairID, JCas casWithAlignment)
+ {
+ this.label = label;
+ this.confidence = confidence;
+ this.pairID = pairID;
+ this.theJCas = casWithAlignment;
+ }
+
+ @Override
+ public DecisionLabel getDecision() {
+ return label;
+ }
+
+ @Override
+ public double getConfidence() {
+ return confidence;
+ }
+
+ @Override
+ public String getPairID() {
+ return pairID;
+ }
+
+ /**
+ * Call this method to access the underlying JCas, which includes the alignment data, and all annotations.
+ *
+ * @return JCas the JCas that holds alignments and all other annotations that were used for EDA decision.
+ */
+ public JCas getJCasWithAlignment() {
+ return theJCas;
+ }
+
+ private final DecisionLabel label;
+ private final double confidence;
+ private final String pairID;
+ private final JCas theJCas;
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/classifiers/EDABinaryClassifierFromWeka.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/classifiers/EDABinaryClassifierFromWeka.java
new file mode 100644
index 00000000..13a1196b
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/classifiers/EDABinaryClassifierFromWeka.java
@@ -0,0 +1,468 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.classifiers;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.DecisionLabelWithConfidence;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.LabeledInstance;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ValueException;
+import eu.excitementproject.eop.common.DecisionLabel;
+import weka.classifiers.Classifier;
+import weka.classifiers.Evaluation;
+//import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.core.Attribute;
+import weka.core.FastVector;
+import weka.core.Instance;
+import weka.core.Instances;
+
+
+/**
+ *
+ * An implementation of "EDAClassifierAbstraction", based on Weka.
+ *
+ * You can use any of the Weka's Classifiers
+ * (e.g. Classifier classes that support Weka's Classifier interface, "distributionForInstance")
+ *
+ * You can change the underlying classifier (that is supported in Weka)
+ * by extend/override prepareWekaClassifierInstance().
+ *
+ * Note that, this class only supports binary classifications only; Any LabeledInstance given
+ * to the training step that is not DecisionLabel.Entailment DecisionLabel.NonEntailment will cause
+ * the implementation to throw an exception.
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public class EDABinaryClassifierFromWeka implements EDAClassifierAbstraction {
+
+ /**
+ * Default (argument-less) constructor. Will initialize the instance with
+ * a default Weka-classifier (here, that default is, NaiveBayes with Kernel density estimation)
+ *
+ * @throws ClassifierException
+ */
+ public EDABinaryClassifierFromWeka() throws ClassifierException {
+ this(new Logistic(), null); // logistic regression is generally go good in most situations.
+ //this(new NaiveBayes(), new String[] {"-K"});
+ }
+
+ /**
+ * The main constructor.
+ *
+ * Pass Weka Classifier Instance, and its options. Then the class will provide all EDAClassifierAbstraction
+ * methods.
+ *
+ * Some possible classes for wekaClassifierInstance. (See their Weka JavaDoc for all option stings)
+ * - NaiveBayes() (weka.classifiers.bayes.NaiveBayes)
+ * - Logistic() (weka.classifiers.functions.Logistic) (a logistic regression)
+ *
+ * TODO: write more some commonly used classifier names, and options; as we test more and more.
+ *
+ * @param wekaClassifierInstance One weka Classifier instance (e.g. new Logistic())
+ * @param classifierOptions Option String[] for the give classifier instance. null means, no passing of options
+ * @throws ClassifierException
+ */
+ public EDABinaryClassifierFromWeka(Classifier wekaClassifierInstance, String[] classifierOptions) throws ClassifierException
+ {
+ this.modelReady = false; // this will become true, only after train (or load model)
+ this.classifier = wekaClassifierInstance;
+
+ if (classifierOptions != null)
+ {
+ try {
+ classifier.setOptions(classifierOptions);
+ }
+ catch (Exception e)
+ {
+ throw new ClassifierException("Underlying Weka classifier class failed to initialize.", e);
+ }
+ }
+ }
+
+// /**
+// * Extend/Override this method to change the classifier & its option.
+// *
+// * @throws ClassifierException
+// */
+// protected void prepareWekaClassifierInstance() throws ClassifierException
+// {
+// modelReady = false;
+// classifier = (Classifier)new NaiveBayes();
+// String[] options = {"-K"};
+// try
+// {
+// classifier.setOptions(options);
+// }
+// catch (Exception e)
+// {
+// throw new ClassifierException("Unable to set classifier options", e);
+// }
+// }
+
+ @Override
+ public DecisionLabelWithConfidence classifyInstance(
+ Vector featureVector) throws ClassifierException {
+
+ if (!modelReady)
+ {
+ throw new ClassifierException("The classifier is not ready for classification; either training, or loading model should be done before calling classify");
+ }
+
+ DecisionLabelWithConfidence result = null;
+
+ // Prepare Feature information (e.g. which index has what feature? required for Weka)
+ Instances attributeInfo = null;
+ try {
+ attributeInfo = buildAttributeInfo(featureVector);
+ }
+ catch (ValueException ve)
+ {
+ throw new ClassifierException("Reading a FeatureValue failed for some reason - must be a code bug! ", ve);
+ }
+
+ // Make a new instance, with the given feature vector.
+ Instance anInstance = null;
+ try {
+ anInstance = new Instance(featureVector.size());
+ anInstance.setDataset(attributeInfo);
+ for(int i=0; i < featureVector.size(); i++)
+ {
+ FeatureValue f = featureVector.get(i);
+ Attribute attr = attributeInfo.attribute(i);
+
+ switch (f.getValueType())
+ {
+ case NOMINAL:
+ anInstance.setValue(attr, f.getNominalValue().toString());
+ break;
+ case BOOLEAN:
+ anInstance.setValue(attr, f.getBooleanValue().toString());
+ break;
+ case DOUBLE:
+ anInstance.setValue(attr, f.getDoubleValue());
+ }
+ }
+ }
+ catch (ValueException ve)
+ {
+ throw new ClassifierException("Reading a FeatureValue failed for some reason - must be a code bug! ", ve);
+ }
+
+ // Okay, classify the newly prepared instance.
+ double[] dist = null;
+ try {
+ dist = classifier.distributionForInstance(anInstance);
+ }
+ catch (Exception e)
+ {
+ throw new ClassifierException("Underlying Weka classifier throws an exception:" + e.getMessage(), e);
+ }
+
+ if (dist[0] > dist[1])
+ {
+ result = new DecisionLabelWithConfidence(DecisionLabel.Entailment, dist[0]);
+ }
+ else
+ {
+ result = new DecisionLabelWithConfidence(DecisionLabel.NonEntailment, dist[1]);
+ }
+
+ return result;
+ }
+
+ @Override
+ public void createClassifierModel(List goldData)
+ throws ClassifierException {
+
+ // Okay; first, convert the goldData into "Weka" training data (Instances).
+ // So we can train a Weka Classifier instance prepared within this wrapper class.
+ Instances trainingData = null;
+ try {
+ trainingData = buildTrainingDataSet(goldData);
+
+ } catch (ValueException ve)
+ {
+ throw new ClassifierException("Failed to read FeatureValue of training data. Must be a bug in code", ve);
+ }
+
+ // Okay, pass trainingData to build classifier.
+
+ try {
+ classifier.buildClassifier(trainingData);
+ }
+ catch (Exception e)
+ {
+ throw new ClassifierException("Underlying Weka Classifier throws exception at training time...", e);
+ }
+
+ // Okay. training is done and the classifier is ready for classification.
+ modelReady = true;
+ }
+
+ @Override
+ public void storeClassifierModel(File path) throws ClassifierException {
+ if (!modelReady)
+ {
+ throw new ClassifierException("The classifier is not ready for classification; either training, or loading model should be done before calling classify");
+ }
+
+ // Okay, store the model in the given path.
+ try {
+ weka.core.SerializationHelper.write(path.getAbsolutePath(), classifier);
+ }
+ catch (Exception e)
+ {
+ throw new ClassifierException("Serializing the trainined Weka classifier model failed, Weka serializationHelper raised an exception: ", e);
+ }
+
+ }
+
+ @Override
+ public void loadClassifierModel(File path) throws ClassifierException {
+
+ if (!path.exists())
+ {
+ throw new ClassifierException("Unable to load trained classifier model; Model file " + path.toString() + " does not exist");
+ }
+
+ try {
+ classifier = (Classifier) weka.core.SerializationHelper.read(path.getAbsolutePath());
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ modelReady = true;
+ }
+
+ @Override
+ public List evaluateClassifier(List goldData)
+ throws ClassifierException {
+
+ // DECIDED: TODOconsider: make it solely as cross-validation? or option for cross-validation?
+ // This code does "as-is" evaluation.
+ // To do cross-validation of the given goldData, support other doCrossValidationEvaluation()
+
+ Instances trainingData = null;
+ Evaluation eTest = null;
+ try {
+ trainingData = buildTrainingDataSet(goldData);
+
+ } catch (ValueException ve)
+ {
+ throw new ClassifierException("Failed to read FeatureValue of training data. Must be a bug in code", ve);
+ }
+ catch (Exception e)
+ {
+ throw new ClassifierException("Underlying Weka Classifier Evaluator throws an exception", e);
+ }
+
+ try {
+ eTest = new Evaluation(trainingData);
+ eTest.evaluateModel(classifier, trainingData);
+ }
+ catch (Exception e)
+ {
+ throw new ClassifierException("Underlying Weka Classifier Evaluator throws an exception", e);
+ }
+
+ // DCODE - as log debug?
+ // System.out.println(eTest.toSummaryString());
+
+ double tp = eTest.weightedTruePositiveRate();
+ double tn = eTest.weightedTrueNegativeRate();
+ double prec = eTest.weightedPrecision();
+ double rec = eTest.weightedRecall();
+ double f1 = eTest.weightedFMeasure();
+ double accuracy = (eTest.correct()) / (eTest.incorrect() + eTest.correct());
+
+ List evalResult = new ArrayList();
+ evalResult.add(accuracy);
+ evalResult.add(f1);
+ evalResult.add(prec);
+ evalResult.add(rec);
+ evalResult.add(tp);
+ evalResult.add(tn);
+
+ return evalResult;
+ }
+
+ /**
+ * @param vec
+ * @return
+ * @throws ValueException
+ */
+ private Instances buildAttributeInfo(Vector vec) throws ValueException
+ {
+
+ FastVector fvWekaAttributes = new FastVector(vec.size() + 1); // why +1? Some Weka classifier cries out loud if this (column size) is different from
+
+ for (int i=0; i < vec.size(); i++)
+ {
+ FeatureValue f = vec.get(i);
+ Attribute attr = null;
+
+ switch(f.getValueType())
+ {
+ case BOOLEAN:
+ // build boolean attribute;
+ // we build a Weka nominal attribute with "true" and "false"
+ FastVector fvBooleanVal = new FastVector(2);
+ fvBooleanVal.addElement("true");
+ fvBooleanVal.addElement("false");
+ attr = new Attribute(Integer.toString(i) + "_aBoolean", fvBooleanVal);
+ fvWekaAttributes.addElement(attr);
+ break;
+
+ case NOMINAL:
+ // build nominal attribute, from enums
+ Enum> e = f.getNominalValue();
+ Enum>[] elist = e.getClass().getEnumConstants();
+ FastVector fvNominalVal = new FastVector(elist.length);
+ for(int j=0; j < elist.length; j++)
+ {
+ fvNominalVal.addElement(elist[j].toString());
+ }
+ attr = new Attribute(Integer.toString(i) + "_aNominal", fvNominalVal);
+ fvWekaAttributes.addElement(attr);
+ break;
+
+ case DOUBLE:
+ // build double (numeric) attribute
+ attr = new Attribute(Integer.toString(i) + "_aNumeric");
+ fvWekaAttributes.addElement(attr);
+ break;
+ }
+ }
+
+ // Features are ready, but put class variable (although not meaningful)
+ // Some Weka classifiers cry out loud if the number of features (including class variable) is different...
+ FastVector fvClassVal = new FastVector(2);
+ fvClassVal.addElement(DecisionLabel.Entailment.toString());
+ fvClassVal.addElement(DecisionLabel.NonEntailment.toString());
+ Attribute ClassAttribute = new Attribute("theClass", fvClassVal);
+ fvWekaAttributes.addElement(ClassAttribute);
+
+
+ Instances attributeTable = new Instances("table", fvWekaAttributes, 10);
+ attributeTable.setClass(ClassAttribute);
+
+ return attributeTable;
+
+ }
+
+ private Instances buildTrainingDataSet(List gold) throws ValueException, ClassifierException
+ {
+
+ // Let's first prepare attribute (feature) header, from the first feature vector
+ Vector vec = gold.get(0).getFeatureVector();
+ int featureSize = vec.size();
+ FastVector fvWekaAttributes = new FastVector(featureSize + 1); // + 1 for label column
+
+
+ // for each value type, prepare attribute column accordingly ...
+ for (int i=0; i < vec.size(); i++)
+ {
+ FeatureValue f = vec.get(i);
+ Attribute attr = null;
+
+ switch(f.getValueType())
+ {
+ case BOOLEAN:
+ // build boolean attribute;
+ // we build a Weka nominal attribute with "true" and "false"
+ FastVector fvBooleanVal = new FastVector(2);
+ fvBooleanVal.addElement("true");
+ fvBooleanVal.addElement("false");
+ attr = new Attribute(Integer.toString(i) + "_aBoolean", fvBooleanVal);
+ fvWekaAttributes.addElement(attr);
+ break;
+
+ case NOMINAL:
+ // build nominal attribute, from enums
+ Enum> e = f.getNominalValue();
+ Enum>[] elist = e.getClass().getEnumConstants();
+ FastVector fvNominalVal = new FastVector(elist.length);
+ for(int j=0; j < elist.length; j++)
+ {
+ fvNominalVal.addElement(elist[j].toString());
+ }
+ attr = new Attribute(Integer.toString(i) + "_aNominal", fvNominalVal);
+ fvWekaAttributes.addElement(attr);
+ break;
+
+ case DOUBLE:
+ // build double (numeric) attribute
+ attr = new Attribute(Integer.toString(i) + "_aNumeric");
+ fvWekaAttributes.addElement(attr);
+ break;
+ }
+ }
+
+ // finally, add "class (decision label)" column
+ // This class, limits it as ENTAILMENT NONENTAILMENT only.
+ // (Binary classification only)
+ FastVector fvClassVal = new FastVector(2);
+ fvClassVal.addElement(DecisionLabel.Entailment.toString());
+ fvClassVal.addElement(DecisionLabel.NonEntailment.toString());
+ Attribute ClassAttribute = new Attribute("theClass", fvClassVal);
+ fvWekaAttributes.addElement(ClassAttribute);
+
+ // okay, prepare an empty instances table with fvWekaAttributes
+ Instances trainingSet = new Instances("trainingData", fvWekaAttributes, gold.size());
+ trainingSet.setClass(ClassAttribute);
+
+ // Table Ready. now populate each and every LabeledInstance into trainingSet
+ for (LabeledInstance inst : gold)
+ {
+ Vector featureVector = inst.getFeatureVector();
+ DecisionLabel goldLabel = inst.getLabel();
+
+ // two sanity checks
+ // if DecisionLabel is other then Entailment / NonEntailment, raise exception
+ if ((goldLabel != DecisionLabel.Entailment) && (goldLabel != DecisionLabel.NonEntailment))
+ {
+ throw new ClassifierException("Sorry, this classifier abstract only treats binary classification... ");
+ }
+
+ // prepare an instance with feature values ...
+ Instance anInstance = new Instance(featureSize + 1);
+ anInstance.setDataset(trainingSet);
+ for(int i=0; i < featureSize; i++)
+ {
+ FeatureValue f = featureVector.get(i);
+ Attribute attr = trainingSet.attribute(i);
+
+ switch (f.getValueType())
+ {
+ case NOMINAL:
+ anInstance.setValue(attr, f.getNominalValue().toString());
+ break;
+ case BOOLEAN:
+ anInstance.setValue(attr, f.getBooleanValue().toString());
+ break;
+ case DOUBLE:
+ anInstance.setValue(attr, f.getDoubleValue());
+ }
+ }
+ // and finally add class label
+ anInstance.setValue(ClassAttribute, inst.getLabel().toString());
+
+ // Okay this instance is ready. Put it in the training set.
+ trainingSet.add(anInstance);
+ }
+ return trainingSet;
+ }
+
+ // private data
+
+ private Classifier classifier;
+ private Boolean modelReady;
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/classifiers/package-info.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/classifiers/package-info.java
new file mode 100644
index 00000000..f8af16e7
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/classifiers/package-info.java
@@ -0,0 +1,8 @@
+/**
+ *
+ * This package holds instances of EDAClassifierAbstraction interfaces.
+ *
+ * Various Classification (Machine learning) libraries mapped into EDAClassificationAbstraction.
+ *
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda.classifiers;
\ No newline at end of file
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/MinimalP1EDA.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/MinimalP1EDA.java
new file mode 100644
index 00000000..6f332ef0
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/MinimalP1EDA.java
@@ -0,0 +1,166 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.instances;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+@SuppressWarnings("unused")
+public class MinimalP1EDA extends P1EDATemplate {
+
+ public MinimalP1EDA() throws EDAException
+ {
+ try {
+ aligner = new IdenticalLemmaPhraseLinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ // Here, just one aligner... (same lemma linker)
+ try {
+ aligner.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent aligner;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageDE.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageDE.java
new file mode 100644
index 00000000..0793fc43
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageDE.java
@@ -0,0 +1,193 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.instances;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.DerivBaseDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermaNetDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermanTransDMDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+/**
+ * A simple German EDA instance based on three basic (language independent) feature extractors.
+ *
+ * On this setup, the best value was 64.5% accuracy with the following two alingers.
+ * (identical lemma + GermaNet)
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+@SuppressWarnings("unused")
+public class SimpleWordCoverageDE extends P1EDATemplate {
+
+ public SimpleWordCoverageDE() throws EDAException
+ {
+ // And let's prepare the aligner instances and scoring components...
+ try {
+ identicalLemmaLinker = new IdenticalLemmaPhraseLinker();
+ meteorParaphraseLinker = new MeteorPhraseLinkerDE();
+ derivBaseLinker = new DerivBaseDELinker();
+ distSimLinker = new GermanTransDMDELinker();
+ germaNetLinker = new GermaNetDELinker("/Users/tailblues/germanet-8.0/GN_V80_XML/"); // please provide correct path for GermaNet!!
+ // see GermaNetDELinker for detail ...
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ try {
+ identicalLemmaLinker.annotate(input);
+// meteorParaphraseLinker.annotate(input);
+// derivBaseLinker.annotate(input);
+// distSimLinker.annotate(input);
+ germaNetLinker.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+
+ // VerbCoverage scorer as-is, generally don't work well with German.
+ // (should use more German specific, predicate coverage approximation)
+// Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+// // we know Verb Coverage counter returns 2 numbers.
+// // (number of covered Vs in H, number of all Vs in H)
+// double ratio_V = 0;
+// // special case first... (hmm would be rare but)
+// if(score3.get(1) ==0)
+// ratio_V = 1.0;
+// else
+// {
+// ratio_V = score3.get(0) / score3.get(1);
+// }
+// fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent identicalLemmaLinker;
+ AlignmentComponent meteorParaphraseLinker;
+ AlignmentComponent derivBaseLinker;
+ AlignmentComponent distSimLinker;
+ AlignmentComponent germaNetLinker;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageEN.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageEN.java
new file mode 100644
index 00000000..8bbb4ad6
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageEN.java
@@ -0,0 +1,187 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.instances;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+/**
+ *
+ *
+ *
+ * (On this simple coverage setup, best was with all four aligners, with three features (without verb coverage ratio)
+ * on RTE3: 67.0)
+ *
+ * @author Tae-Gil Noh
+ */
+@SuppressWarnings("unused")
+public class SimpleWordCoverageEN extends P1EDATemplate {
+
+ public SimpleWordCoverageEN() throws EDAException
+ {
+ try {
+ aligner1 = new IdenticalLemmaPhraseLinker();
+ aligner2 = new MeteorPhraseLinkerEN();
+ aligner3 = new WordNetENLinker(null);
+ aligner4 = new VerbOceanENLinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ // Here, just one aligner... (same lemma linker)
+ try {
+ aligner1.annotate(input);
+ aligner2.annotate(input);
+ aligner3.annotate(input); // WordNet. Really slow in its current form. (several hours)
+ aligner4.annotate(input);
+
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ // For English, verb coverage feature doesn't seem to work well.
+ //fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ // Now return the feature vector. The P1EDA template will use this.
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent aligner1;
+ AlignmentComponent aligner2;
+ AlignmentComponent aligner3;
+ AlignmentComponent aligner4;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageIT.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageIT.java
new file mode 100644
index 00000000..144a72a4
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/SimpleWordCoverageIT.java
@@ -0,0 +1,184 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.instances;
+
+import java.io.File;
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetITLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerIT;
+
+/**
+ *
+ *
+ * (Best configuration on this simple coverage Italian was: 65.125 on RTE3.)
+ *
+ * @author Tae-Gil Noh
+ */
+@SuppressWarnings("unused")
+public class SimpleWordCoverageIT extends P1EDATemplate {
+
+ public SimpleWordCoverageIT() throws EDAException
+ {
+ try {
+ identicalLemmaLinker = new IdenticalLemmaPhraseLinker();
+ paraphraseLinker = new MeteorPhraseLinkerIT();
+ italianWordNetLinker = new WordNetITLinker(new File("/Users/tailblues/eop-resources-1.1.3/ontologies/ItalianWordNet-dict"));
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ try {
+ identicalLemmaLinker.annotate(input);
+ // slightly better result without using paraphrase linker, but...
+ paraphraseLinker.annotate(input);
+ italianWordNetLinker.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ // For Italian, PN coverage seems to work less well...
+ //fv.add(new FeatureValue(ratio_ner));
+
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent identicalLemmaLinker;
+ AlignmentComponent paraphraseLinker;
+ AlignmentComponent italianWordNetLinker;
+ AlignmentComponent italianWikiLinker;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/package-info.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/package-info.java
new file mode 100644
index 00000000..1247c89d
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/instances/package-info.java
@@ -0,0 +1,13 @@
+/**
+ *
+ * This package holds "configured" instances of P1EDAs.
+ *
+ * Note that, by configure, it means that the "P1EDA template" has been extended,
+ * and filled in with "minimally required" two methods.
+ *
+ * See ... for example; SimpleWordCoverageEN class, where it implements two abstract methods
+ * addAnnotations() and evaluateAlignments().
+ *
+ * @author Tae-Gil Noh
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda.instances;
\ No newline at end of file
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/package-info.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/package-info.java
new file mode 100644
index 00000000..d01613af
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/package-info.java
@@ -0,0 +1,16 @@
+
+/**
+ *
+ * This package holds various template classes for Phase-1 Alignment-based EDA, which is a
+ * prototype (or a proof-of-concept) EDA which tries to build EDA as an "open" box (vs. black box).
+ *
+ * How to read / access the classes in this package?
+ *
+ * (TODO fill in overview here once finished)
+ *
+ * - check p1eda.instances for running examples, such as English, German and Italian P1EDA instances.
+ *
+ * @author Tae-Gil Noh
+ * @since July 2014
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda;
\ No newline at end of file
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DE.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DE.java
new file mode 100644
index 00000000..8494f2d9
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DE.java
@@ -0,0 +1,186 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.DerivBaseDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermaNetDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermanTransDMDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+/**
+ * Fast aNd Reliable, word-coverage based German configuration of P1EDA.
+ * (This setting will get you around 63-64% accuracy on German RTE3.
+ * Not the best setting, but more reliable, and fast to be used on "any" text. )
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+@SuppressWarnings("unused")
+public class FNR_DE extends P1EDATemplate {
+
+ public FNR_DE() throws EDAException
+ {
+ // And let's prepare the aligner instances and scoring components...
+ try {
+ identicalLemmaLinker = new IdenticalLemmaPhraseLinker();
+ meteorParaphraseLinker = new MeteorPhraseLinkerDE();
+// derivBaseLinker = new DerivBaseDELinker();
+// distSimLinker = new GermanTransDMDELinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ try {
+ identicalLemmaLinker.annotate(input);
+ meteorParaphraseLinker.annotate(input);
+// derivBaseLinker.annotate(input);
+// distSimLinker.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent identicalLemmaLinker;
+ AlignmentComponent meteorParaphraseLinker;
+ AlignmentComponent derivBaseLinker;
+ AlignmentComponent distSimLinker;
+ AlignmentComponent germaNetLinker;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar1.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar1.java
new file mode 100644
index 00000000..33550ea7
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar1.java
@@ -0,0 +1,186 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.DerivBaseDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermaNetDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermanTransDMDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+/**
+ * Fast aNd Reliable, word-coverage based German configuration of P1EDA.
+ *
+ * var1: is FNR_DE + derivBase links
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+@SuppressWarnings("unused")
+public class FNR_DEvar1 extends P1EDATemplate {
+
+ public FNR_DEvar1() throws EDAException
+ {
+ // And let's prepare the aligner instances and scoring components...
+ try {
+ identicalLemmaLinker = new IdenticalLemmaPhraseLinker();
+ meteorParaphraseLinker = new MeteorPhraseLinkerDE();
+ derivBaseLinker = new DerivBaseDELinker();
+// distSimLinker = new GermanTransDMDELinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ try {
+ identicalLemmaLinker.annotate(input);
+ meteorParaphraseLinker.annotate(input);
+ derivBaseLinker.annotate(input);
+// distSimLinker.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent identicalLemmaLinker;
+ AlignmentComponent meteorParaphraseLinker;
+ AlignmentComponent derivBaseLinker;
+ AlignmentComponent distSimLinker;
+ AlignmentComponent germaNetLinker;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar2.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar2.java
new file mode 100644
index 00000000..415fcee7
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar2.java
@@ -0,0 +1,186 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.DerivBaseDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermaNetDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermanTransDMDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+/**
+ * Fast aNd Reliable, word-coverage based German configuration of P1EDA.
+ *
+ * var2: FNR + German TransDM links
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+@SuppressWarnings("unused")
+public class FNR_DEvar2 extends P1EDATemplate {
+
+ public FNR_DEvar2() throws EDAException
+ {
+ // And let's prepare the aligner instances and scoring components...
+ try {
+ identicalLemmaLinker = new IdenticalLemmaPhraseLinker();
+ meteorParaphraseLinker = new MeteorPhraseLinkerDE();
+// derivBaseLinker = new DerivBaseDELinker();
+ distSimLinker = new GermanTransDMDELinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ try {
+ identicalLemmaLinker.annotate(input);
+ meteorParaphraseLinker.annotate(input);
+// derivBaseLinker.annotate(input);
+ distSimLinker.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent identicalLemmaLinker;
+ AlignmentComponent meteorParaphraseLinker;
+ AlignmentComponent derivBaseLinker;
+ AlignmentComponent distSimLinker;
+ AlignmentComponent germaNetLinker;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar3.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar3.java
new file mode 100644
index 00000000..d97fb8a1
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar3.java
@@ -0,0 +1,186 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.DerivBaseDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermaNetDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermanTransDMDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+/**
+ * Fast aNd Reliable, word-coverage based German configuration of P1EDA.
+ *
+ * var3: FNR_DE + derivBase and TransDM links
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+@SuppressWarnings("unused")
+public class FNR_DEvar3 extends P1EDATemplate {
+
+ public FNR_DEvar3() throws EDAException
+ {
+ // And let's prepare the aligner instances and scoring components...
+ try {
+ identicalLemmaLinker = new IdenticalLemmaPhraseLinker();
+ meteorParaphraseLinker = new MeteorPhraseLinkerDE();
+ derivBaseLinker = new DerivBaseDELinker();
+ distSimLinker = new GermanTransDMDELinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ try {
+ identicalLemmaLinker.annotate(input);
+ meteorParaphraseLinker.annotate(input);
+ derivBaseLinker.annotate(input);
+ distSimLinker.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent identicalLemmaLinker;
+ AlignmentComponent meteorParaphraseLinker;
+ AlignmentComponent derivBaseLinker;
+ AlignmentComponent distSimLinker;
+ AlignmentComponent germaNetLinker;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar4.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar4.java
new file mode 100644
index 00000000..f28c9b80
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_DEvar4.java
@@ -0,0 +1,181 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.DerivBaseDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermaNetDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.GermanTransDMDELinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+/**
+ * Fast aNd Reliable, word-coverage based German configuration of P1EDA.
+ *
+ * var4: FNR_DE *minus* German para-phrase links. This means, only identical lemma links.
+ * the bare minimum.
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+@SuppressWarnings("unused")
+public class FNR_DEvar4 extends P1EDATemplate {
+
+ public FNR_DEvar4() throws EDAException
+ {
+ // And let's prepare the aligner instances and scoring components...
+ try {
+ identicalLemmaLinker = new IdenticalLemmaPhraseLinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ try {
+ identicalLemmaLinker.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent identicalLemmaLinker;
+ AlignmentComponent meteorParaphraseLinker;
+ AlignmentComponent derivBaseLinker;
+ AlignmentComponent distSimLinker;
+ AlignmentComponent germaNetLinker;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_EN.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_EN.java
new file mode 100644
index 00000000..344c679f
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_EN.java
@@ -0,0 +1,177 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+/**
+ *
+ * Fast aNd Reliable, word-coverage based English configuration of P1EDA.
+ * (This setting will get you around 65-66% accuracy on RTE3. Not the best setting,
+ * but more reliable, and fast to be used on "any" text. )
+ *
+ * Mainly to be used for WP6 experiments.
+ *
+ * @author Tae-Gil Noh
+ */
+@SuppressWarnings("unused")
+public class FNR_EN extends P1EDATemplate {
+
+ public FNR_EN() throws EDAException
+ {
+ try {
+ aligner1 = new IdenticalLemmaPhraseLinker();
+ aligner2 = new MeteorPhraseLinkerEN();
+// aligner3 = new WordNetENLinker(null); // due to its slowness.
+// aligner4 = new VerbOceanENLinker(); // due to its usage of fixed-path.
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ // Here, just one aligner... (same lemma linker)
+ try {
+ aligner1.annotate(input);
+ aligner2.annotate(input);
+// aligner3.annotate(input); // WordNet. Really slow in its current form. (several hours)
+// aligner4.annotate(input); // not to be used by TL. (due to need of external path)
+
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ // Now return the feature vector. The P1EDA template will use this.
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+ AlignmentComponent aligner1;
+ AlignmentComponent aligner2;
+// AlignmentComponent aligner3;
+// AlignmentComponent aligner4;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_IT.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_IT.java
new file mode 100644
index 00000000..d8a01ab7
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/FNR_IT.java
@@ -0,0 +1,183 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.io.File;
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetITLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerIT;
+
+/**
+ *
+ * Fast aNd Reliable, word-coverage based Italian configuration of P1EDA.
+ * (This setting will get you accuracy 64.875 on RTE3-IT. Not the best
+ * setting, but reliable, and fast to be used on "any" text. )
+ *
+ * Mainly to be used for WP6 experiments.
+ *
+ * @author Tae-Gil Noh
+ */
+@SuppressWarnings("unused")
+public class FNR_IT extends P1EDATemplate {
+
+ public FNR_IT() throws EDAException
+ {
+ try {
+ identicalLemmaLinker = new IdenticalLemmaPhraseLinker();
+ paraphraseLinker = new MeteorPhraseLinkerIT();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ try {
+ identicalLemmaLinker.annotate(input);
+ paraphraseLinker.annotate(input);
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent identicalLemmaLinker;
+ AlignmentComponent paraphraseLinker;
+ AlignmentComponent italianWordNetLinker;
+ AlignmentComponent italianWikiLinker;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WNVOMT.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WNVOMT.java
new file mode 100644
index 00000000..852821a5
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WNVOMT.java
@@ -0,0 +1,178 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+@SuppressWarnings("unused")
+public class WNVOMT extends P1EDATemplate {
+
+ public WNVOMT() throws EDAException
+ {
+ // And let's keep the alinger instance and scoring component...
+ // This configuration keeps just one for each. (as-is counter)
+ try {
+ aligner1 = new IdenticalLemmaPhraseLinker();
+ aligner2 = new MeteorPhraseLinkerEN();
+ aligner3 = new WordNetENLinker(null);
+ aligner4 = new VerbOceanENLinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ // Here, just one aligner... (same lemma linker)
+ try {
+ aligner1.annotate(input);
+ aligner2.annotate(input);
+ aligner3.annotate(input); // WordNet. Really slow in its current form. (several hours)
+ aligner4.annotate(input);
+
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent aligner1;
+ AlignmentComponent aligner2;
+ AlignmentComponent aligner3;
+ AlignmentComponent aligner4;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WithVO.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WithVO.java
new file mode 100644
index 00000000..c2fab9de
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WithVO.java
@@ -0,0 +1,178 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+@SuppressWarnings("unused")
+public class WithVO extends P1EDATemplate {
+
+ public WithVO() throws EDAException
+ {
+ // And let's keep the alinger instance and scoring component...
+ // This configuration keeps just one for each. (as-is counter)
+ try {
+ aligner1 = new IdenticalLemmaPhraseLinker();
+ aligner2 = new MeteorPhraseLinkerEN();
+// aligner3 = new WordNetENLinker(null);
+ aligner4 = new VerbOceanENLinker();
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ // Here, just one aligner... (same lemma linker)
+ try {
+ aligner1.annotate(input);
+ aligner2.annotate(input);
+// aligner3.annotate(input); // WordNet. Really slow in its current form. (several hours)
+ aligner4.annotate(input);
+
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent aligner1;
+ AlignmentComponent aligner2;
+ AlignmentComponent aligner3;
+ AlignmentComponent aligner4;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WithoutVO.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WithoutVO.java
new file mode 100644
index 00000000..00e5ecc0
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/WithoutVO.java
@@ -0,0 +1,178 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
+
+import java.util.Vector;
+
+import org.apache.uima.jcas.JCas;
+
+import weka.classifiers.bayes.NaiveBayes;
+import weka.classifiers.functions.Logistic;
+import weka.classifiers.functions.MultilayerPerceptron;
+import weka.classifiers.functions.SimpleLogistic;
+import weka.classifiers.functions.VotedPerceptron;
+import weka.classifiers.lazy.KStar;
+import weka.classifiers.meta.LogitBoost;
+import weka.classifiers.trees.J48;
+import weka.classifiers.trees.RandomForest;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleVerbCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ClassifierException;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.ParameterValue;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.alignment.PairAnnotatorComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.VerbOceanENLinker;
+import eu.excitementproject.eop.core.component.alignment.lexicallink.wrapped.WordNetENLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerDE;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+
+@SuppressWarnings("unused")
+public class WithoutVO extends P1EDATemplate {
+
+ public WithoutVO() throws EDAException
+ {
+ // And let's keep the alinger instance and scoring component...
+ // This configuration keeps just one for each. (as-is counter)
+ try {
+ aligner1 = new IdenticalLemmaPhraseLinker();
+ aligner2 = new MeteorPhraseLinkerEN();
+// aligner3 = new WordNetENLinker(null);
+// aligner4 = new VerbOceanENLinker(null);
+ }
+ catch (AlignmentComponentException ae)
+ {
+ throw new EDAException("Initializing Alignment components failed: " + ae.getMessage(), ae);
+ }
+
+ wordCoverageScorer = new SimpleWordCoverageCounter(null);
+ nerCoverageScorer = new SimpleProperNounCoverageCounter();
+ verbCoverageScorer = new SimpleVerbCoverageCounter();
+ }
+
+ @Override
+ public void addAlignments(JCas input) throws EDAException {
+
+ // Here, just one aligner... (same lemma linker)
+ try {
+ aligner1.annotate(input);
+ aligner2.annotate(input);
+// aligner3.annotate(input); // WordNet. Really slow in its current form. (several hours)
+// aligner4.annotate(input);
+
+ }
+ catch (PairAnnotatorComponentException pe)
+ {
+ throw new EDAException("Underlying aligner raised an exception", pe);
+ }
+
+ }
+
+ @Override
+ public Vector evaluateAlignments(JCas aJCas, Vector param) throws EDAException {
+
+ // The simplest possible method... that works well with simple alignment added
+ // on addAlignments step.
+ // count the "covered" ratio (== H term linked) of words in H.
+ // Note that this instance does not utilize param at all.
+
+ // the feature vector that will be filled in
+ Vector fv = new Vector();
+ try {
+ Vector score1 = wordCoverageScorer.calculateScores(aJCas);
+ // we know word Coverage scorer returns 4 numbers.
+ // ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ // Make two "coverage" ratio now.
+
+ double ratio1 = score1.get(0) / score1.get(1);
+ double ratio2 = score1.get(2) / score1.get(3);
+
+ logger.debug("Adding feature as: " + score1.get(0) + "/" + score1.get(1));
+ logger.debug("Adding feature as: " + score1.get(2) + "/" + score1.get(3));
+ fv.add(new FeatureValue(ratio1));
+ fv.add(new FeatureValue(ratio2));
+
+ Vector score2 = nerCoverageScorer.calculateScores(aJCas);
+ // we know NER Coverage scorer returns 2 numbers.
+ // (number of ner words covered in H, number of all NER words in H)
+ // let's make one coverage ratio.
+
+ // ratio of Proper noun coverage ...
+ double ratio_ner = 0;
+ // special case first ...
+ if (score2.get(1) == 0)
+ ratio_ner = 1.0;
+ else
+ {
+ ratio_ner = score2.get(0) / score2.get(1);
+ }
+ fv.add(new FeatureValue(ratio_ner));
+
+
+ Vector score3 = verbCoverageScorer.calculateScores(aJCas);
+ // we know Verb Coverage counter returns 2 numbers.
+ // (number of covered Vs in H, number of all Vs in H)
+ double ratio_V = 0;
+ // special case first... (hmm would be rare but)
+ if(score3.get(1) ==0)
+ ratio_V = 1.0;
+ else
+ {
+ ratio_V = score3.get(0) / score3.get(1);
+ }
+ fv.add(new FeatureValue(ratio_V));
+
+ }
+ catch (ScoringComponentException se)
+ {
+ throw new EDAException("Scoring component raised an exception", se);
+ }
+ catch (ArrayIndexOutOfBoundsException obe)
+ {
+ throw new EDAException("Integrity failure - this simply shouldn't happen", obe);
+ }
+
+ return fv;
+ }
+
+ @Override
+ protected EDAClassifierAbstraction prepareClassifier() throws EDAException
+ {
+ try {
+ return new EDABinaryClassifierFromWeka(new Logistic(), null);
+ // you can use other classifiers from Weka, such as ...
+ //return new EDABinaryClassifierFromWeka(new NaiveBayes(), null);
+ //return new EDABinaryClassifierFromWeka(new VotedPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new J48(), null);
+ //return new EDABinaryClassifierFromWeka(new MultilayerPerceptron(), null);
+ //return new EDABinaryClassifierFromWeka(new KStar(), null);
+ //return new EDABinaryClassifierFromWeka(new SimpleLogistic(), null);
+ //return new EDABinaryClassifierFromWeka(new RandomForest(), null);
+
+ }
+ catch (ClassifierException ce)
+ {
+ throw new EDAException("Preparing an instance of Classifier for EDA failed: underlying Classifier raised an exception: ", ce);
+ }
+ }
+
+
+ AlignmentComponent aligner1;
+ AlignmentComponent aligner2;
+ AlignmentComponent aligner3;
+ AlignmentComponent aligner4;
+
+ ScoringComponent wordCoverageScorer;
+ ScoringComponent nerCoverageScorer;
+ ScoringComponent verbCoverageScorer;
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/package-info.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/package-info.java
new file mode 100644
index 00000000..174d7b3b
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/sandbox/package-info.java
@@ -0,0 +1,8 @@
+
+/**
+ * A sandbox where you can add various "setups", that configures (extends) P1EDA templates.
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda.sandbox;
\ No newline at end of file
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleProperNounCoverageCounter.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleProperNounCoverageCounter.java
new file mode 100644
index 00000000..9e59b4fa
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleProperNounCoverageCounter.java
@@ -0,0 +1,137 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.scorers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.util.JCasUtil;
+
+import de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.NP;
+import de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS;
+import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;
+import eu.excitement.type.alignment.Link;
+import eu.excitement.type.alignment.LinkUtils;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.lap.implbase.LAP_ImplBase;
+
+/**
+ * (A Language Independent scorer)
+ *
+ * A simple, POS-based coverage feature extractor that extracts
+ * how much of Hypothesis named entities are covered. The decision
+ * is done purely based on canonical POS type NP (proper noun), and
+ * not based on proper NER. The good thing about this is that this
+ * would work for any language that properly supports canonical-POS.
+ *
+ * So use this as generic, simple approximation feature.
+ *
+ * The scorer always returns two numbers. They are;
+ * ( number of Proper Nouns covered in H side, number of proper nouns in H side )
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public class SimpleProperNounCoverageCounter implements ScoringComponent {
+
+ public SimpleProperNounCoverageCounter() {
+ }
+
+ @Override
+ public Vector calculateScores(JCas aJCas)
+ throws ScoringComponentException {
+
+ Vector result = new Vector();
+ JCas hView = null;
+
+ // get all NP Tokens.
+ Collection propNounTokens = new ArrayList();
+ Collection allTokens = null;
+ try {
+ hView = aJCas.getView(LAP_ImplBase.HYPOTHESISVIEW);
+ allTokens = JCasUtil.select(hView, Token.class);
+ }
+ catch (CASException ce)
+ {
+ throw new ScoringComponentException("Accessing CAS HView failed!", ce);
+ }
+
+ for (Token t : allTokens)
+ {
+ POS p = t.getPos();
+ if (p == null)
+ {
+ throw new ScoringComponentException("Cannot proceed, this scoring component requires POS annotated");
+ }
+
+ if (p.getTypeIndexID() == NP.typeIndexID)
+ {
+ propNounTokens.add(t);
+ }
+ }
+
+
+ int countPNTokens = propNounTokens.size();
+ int countCoveredPNTokens = 0;
+
+ logger.debug("calculateScore: count propNoun tokens, HView: " + countPNTokens);
+
+ List links = null;
+ try
+ {
+ links = LinkUtils.selectLinksWith(aJCas, (String) null);
+ }
+ catch(CASException ce)
+ {
+ throw new ScoringComponentException("Accessing CAS failed somehow!", ce);
+ }
+
+ logger.debug("calculateScore: total " + links.size() + " links fetched");
+
+ // for each Token, check if this token is covered.
+ if (links.size() == 0)
+ {
+ // no need to count
+ countCoveredPNTokens = 0;
+ }
+ else
+ {
+ for(Token tok : propNounTokens)
+ {
+ logger.debug("Checking Token " + tok.getCoveredText());
+
+ List linksHoldingThisToken = SimpleWordCoverageCounter.filterLinksWithTargetsIncluding(links, tok);
+ if (linksHoldingThisToken.size() != 0)
+ {
+ countCoveredPNTokens ++;
+ logger.debug("The token is covered by " + linksHoldingThisToken.size() + " link(s).");
+ }
+ }
+ }
+
+ // Okay. Now we have the two numbers. Return them as is.
+ result.add((double) countCoveredPNTokens);
+ result.add((double) countPNTokens);
+
+ return result;
+ }
+
+
+ @Override
+ public String getComponentName() {
+ return getClass().getName();
+ }
+
+ @Override
+ public String getInstanceName() {
+ return null;
+ }
+
+ // privates
+ private final static Logger logger = Logger.getLogger(SimpleProperNounCoverageCounter.class);
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleVerbCoverageCounter.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleVerbCoverageCounter.java
new file mode 100644
index 00000000..a26dc7b2
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleVerbCoverageCounter.java
@@ -0,0 +1,143 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.scorers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.util.JCasUtil;
+
+//import de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.NP;
+import de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS;
+import de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.V;
+import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;
+import eu.excitement.type.alignment.Link;
+import eu.excitement.type.alignment.LinkUtils;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.lap.implbase.LAP_ImplBase;
+
+/**
+ * (A Language Independent scorer)
+ * It would be ideal, if we can count coverage of "main verb", or "predicates"
+ *
+ * Since that is not possible with simple "lexical" level alignments, here we
+ * try to check "verbs". We try to exclude all auxiliary verbs .. but that isn't easily
+ * possible in canonical POSes.
+ *
+ * So in this simple, language independent module, we only try "verb coverage".
+ *
+ * The scorer always returns two numbers. They are;
+ * ( number of Verbs covered in H side, number of verbs in H side )
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public class SimpleVerbCoverageCounter implements ScoringComponent {
+
+ public SimpleVerbCoverageCounter() {
+ }
+
+ @Override
+ public Vector calculateScores(JCas aJCas)
+ throws ScoringComponentException {
+ Vector result = new Vector();
+ JCas hView = null;
+
+ // get all Verb Tokens.
+ Collection verbTokens = new ArrayList();
+ Collection allTokens = null;
+ try {
+ hView = aJCas.getView(LAP_ImplBase.HYPOTHESISVIEW);
+ allTokens = JCasUtil.select(hView, Token.class);
+ }
+ catch (CASException ce)
+ {
+ throw new ScoringComponentException("Accessing CAS HView failed!", ce);
+ }
+
+ for (Token t : allTokens)
+ {
+ POS p = t.getPos();
+ if (p == null)
+ {
+ throw new ScoringComponentException("Cannot proceed, this scoring component requires POS annotated");
+ }
+
+ if (p.getTypeIndexID() == V.typeIndexID)
+ {
+ verbTokens.add(t);
+ }
+ }
+
+
+ int countVTokens = verbTokens.size();
+ int countCoveredVTokens = 0;
+
+ logger.debug("calculateScore: count verb tokens, HView: " + countVTokens);
+
+ List links = null;
+ try
+ {
+ links = LinkUtils.selectLinksWith(aJCas, (String) null);
+ }
+ catch(CASException ce)
+ {
+ throw new ScoringComponentException("Accessing CAS failed somehow!", ce);
+ }
+
+ logger.debug("calculateScore: total " + links.size() + " links fetched");
+
+ // for each Token, check if this token is covered.
+ if (links.size() == 0)
+ {
+ // no need to count
+ countCoveredVTokens = 0;
+ }
+ else
+ {
+ for(Token tok : verbTokens)
+ {
+ logger.debug("Checking Token " + tok.getCoveredText());
+
+ List linksHoldingThisToken = SimpleWordCoverageCounter.filterLinksWithTargetsIncluding(links, tok);
+ if (linksHoldingThisToken.size() != 0)
+ {
+ countCoveredVTokens ++;
+ logger.debug("The token is covered by " + linksHoldingThisToken.size() + " link(s).");
+ }
+ }
+ }
+
+ // Okay. Now we have the two numbers. Return them as is.
+ result.add((double) countCoveredVTokens);
+ result.add((double) countVTokens);
+
+ return result;
+ }
+
+
+
+ @Override
+ public String getComponentName() {
+ return getClass().getName();
+ }
+
+ @Override
+ public String getInstanceName() {
+ return null;
+ }
+
+ // privates
+ private final static Logger logger = Logger.getLogger(SimpleProperNounCoverageCounter.class);
+
+
+ // TODO:
+ // Keep list of common auxiliary verbs (let's say, stop verbs), and ignore them in the counting.
+ // And this list, is overriden by extension of this base case; thus language-specific versions can
+ // be built from this class as super...
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleWordCoverageCounter.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleWordCoverageCounter.java
new file mode 100644
index 00000000..d1e51bfe
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/SimpleWordCoverageCounter.java
@@ -0,0 +1,230 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.scorers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.uimafit.util.JCasUtil;
+
+import de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS;
+import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;
+import eu.excitement.type.alignment.Link;
+import eu.excitement.type.alignment.LinkUtils;
+import eu.excitement.type.alignment.Target;
+//import eu.excitementproject.eop.common.component.alignment.AlignmentComponentException;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponentException;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.lap.implbase.LAP_ImplBase;
+
+/**
+ * (A Language Independent scorer)
+ *
+ * This is a very simple "alignment evaluator" which reports the following numbers;
+ * "number of covered word in H", "number of words in H".
+ *
+ * calculateScores() method will return 4 numbers
+ * ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ *
+ * CAS needs POS annotations and Token annotations, minimally.
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public class SimpleWordCoverageCounter implements ScoringComponent {
+
+ /**
+ * Argument version: gets one linkID of alignment.Link. Then the module uses alignment.Link instances
+ * with that ID, to calculate "coverage".
+ * If null given, the module uses, *all* link instances to calculate coverage.
+ *
+ * calculateScores will return 4 numbers
+ * ( count covered tokens , count all tokens, count covered content-tokens, count all content-tokens)
+ *
+ * Content token means, tokens with POS other than "PUNC", "PP", "O", "CONJ", "ART"
+ */
+ public SimpleWordCoverageCounter(String alignerID) {
+ this.alignerIdToMatch = alignerID;
+ }
+
+
+ @Override
+ public Vector calculateScores(JCas aJCas)
+ throws ScoringComponentException {
+
+ Vector result = new Vector(4); // this module always returns four numbers
+ JCas hView = null;
+
+ // get the list of tokens
+ Collection allTokens = null;
+ try {
+ hView = aJCas.getView(LAP_ImplBase.HYPOTHESISVIEW);
+ allTokens = JCasUtil.select(hView, Token.class);
+ }
+ catch (CASException ce)
+ {
+ throw new ScoringComponentException("Accessing CAS HView failed!", ce);
+ }
+ int countTokens = allTokens.size();
+ int countContentTokens = allTokens.size(); // will be reduced within the loops, to reflect only content words.
+ int countCoveredTokens = 0;
+ int countCoveredContentTokens = 0;
+
+ logger.debug("calculateScore: count all tokens, HView: " + countTokens);
+
+ // get all Links with the ID
+ if (alignerIdToMatch == null)
+ {
+ logger.debug("calculateScore: all links are fetched");
+ }
+ else
+ {
+ logger.debug("calculateScore: links with ID \"" + this.alignerIdToMatch + "\" are fetched");
+ }
+
+ List linksWithTheID = null;
+ try
+ {
+ linksWithTheID = LinkUtils.selectLinksWith(aJCas, this.alignerIdToMatch);
+ }
+ catch(CASException ce)
+ {
+ throw new ScoringComponentException("Accessing CAS failed somehow!", ce);
+ }
+
+ logger.debug("calculateScore: total " + linksWithTheID.size() + " links fetched");
+
+ // for each Token, check if this token is covered.
+ if (linksWithTheID.size() == 0)
+ {
+ // no need to count
+ countCoveredTokens = 0;
+ }
+ else
+ {
+ for(Token tok : allTokens)
+ {
+ logger.debug("Checking Token " + tok.getCoveredText());
+
+ Boolean nonContentToken = isNonContentToken(tok);
+ if (nonContentToken)
+ {
+ countContentTokens --;
+ }
+
+ List linksHoldingThisToken = filterLinksWithTargetsIncluding(linksWithTheID, tok);
+ if (linksHoldingThisToken.size() != 0)
+ {
+ countCoveredTokens ++;
+ logger.debug("The token is covered by " + linksHoldingThisToken.size() + " link(s).");
+ if (!nonContentToken)
+ {
+ countCoveredContentTokens++;
+ }
+ }
+ }
+ }
+
+ // now the two numbers are ready.
+ result.add((double) countCoveredTokens);
+ result.add((double) countTokens);
+ result.add((double) countCoveredContentTokens);
+ result.add((double) countContentTokens);
+
+ return result;
+ }
+
+
+ /** Maybe this need to go to LinkUtils
+ * TODO: export this method with "direction selection" option to LinkUtils
+ *
+ * @param fullList The full list of Links
+ * @param annot The annotation that is being considered.
+ * @return
+ */
+ public static List filterLinksWithTargetsIncluding(List fullList, T annot)
+ {
+ List filteredList = new ArrayList();
+
+ for (Link l : fullList)
+ {
+ Target tSideTarget = l.getTSideTarget();
+ Target hSideTarget = l.getHSideTarget();
+
+ FSArray arr = null;
+ arr = tSideTarget.getTargetAnnotations();
+ for (Annotation a : JCasUtil.select(arr, Annotation.class))
+ {
+ if (a == annot)
+ {
+ filteredList.add(l);
+ break;
+ }
+ }
+
+ arr = hSideTarget.getTargetAnnotations();
+ for (Annotation a : JCasUtil.select(arr, Annotation.class))
+ {
+ if (a == annot)
+ {
+ // In this score component, we ignore HtoT case. (only TtoH and bidirection)
+ // Hmm. possible better coding for this?
+ if (l.getDirection() == Link.Direction.HtoT)
+ break;
+ filteredList.add(l);
+ break;
+ }
+ }
+ }
+
+ return filteredList;
+ }
+
+
+ @Override
+ public String getComponentName() {
+ return getClass().getName();
+ }
+
+ @Override
+ public String getInstanceName() {
+ return null;
+ }
+
+ /**
+ * This utility checks if the token is one of non-content token type.
+ * (e.g. "PUNC", "PP", "O", "CONJ", "ART"). Actual definition of non content POSes
+ * are borrowed from a static definition set in IdenticalLemmaPhraseLinker.
+ *
+ * @param t The token to be checked.
+ * @return
+ */
+ private boolean isNonContentToken(Token t) throws ScoringComponentException
+ {
+
+ POS p = t.getPos();
+ if (p == null)
+ {
+ throw new ScoringComponentException("The module requires POS annotated for the Tokens, to check non-content words");
+ }
+ String s = p.getType().toString();
+ String typeString = s.substring(s.lastIndexOf(".") + 1);
+ //String logline = t.getCoveredText() + "/" + typeString + ", ";
+ Boolean result = IdenticalLemmaPhraseLinker.isNonContentPos.containsKey(typeString);
+ logger.debug(t.getCoveredText() + "/" + typeString + ": isNonContentToken: " + result);
+
+ return result;
+ }
+
+ private final String alignerIdToMatch;
+ private final static Logger logger = Logger.getLogger(SimpleWordCoverageCounter.class);
+
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/package-info.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/package-info.java
new file mode 100644
index 00000000..3b23f91f
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/scorers/package-info.java
@@ -0,0 +1,8 @@
+/**
+ * This package holds some example Scorer ("Feature extractors", or "alignment evaluators", or JCas with alignment
+ * in and some features out) modules for P1EDA.
+ *
+ *
+ * @author Tae-Gil Noh
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda.scorers;
\ No newline at end of file
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ClassifierException.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ClassifierException.java
new file mode 100644
index 00000000..2782f255
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ClassifierException.java
@@ -0,0 +1,23 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
+
+public class ClassifierException extends Exception {
+
+ /**
+ * An exception designed to be thrown from EDAClassifierAbstraction implementations
+ */
+ private static final long serialVersionUID = 1408025289983238534L;
+
+ public ClassifierException(String message) {
+ super(message);
+ }
+
+ public ClassifierException(Throwable cause) {
+ super(cause);
+ }
+
+ public ClassifierException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/DecisionLabelWithConfidence.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/DecisionLabelWithConfidence.java
new file mode 100644
index 00000000..f29ecc0e
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/DecisionLabelWithConfidence.java
@@ -0,0 +1,29 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
+
+import eu.excitementproject.eop.common.DecisionLabel;
+
+/**
+ * Classification result for single TE instance, on EDAClassifierAbstraction
+ *
+ * @author Tae-Gil Noh
+ */
+public class DecisionLabelWithConfidence {
+
+ public DecisionLabelWithConfidence(DecisionLabel label, double confidence) {
+ this.label = label;
+ this.confidence = confidence;
+ }
+
+ public DecisionLabel getLabel()
+ {
+ return label;
+ }
+
+ public double getConfidence()
+ {
+ return confidence;
+ }
+
+ private final DecisionLabel label;
+ private final double confidence;
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/EDAClassifierAbstraction.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/EDAClassifierAbstraction.java
new file mode 100644
index 00000000..ab49b7fd
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/EDAClassifierAbstraction.java
@@ -0,0 +1,50 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
+
+import java.io.File;
+import java.util.List;
+import java.util.Vector;
+
+
+/**
+ *
+ * An abstract for classifier(s) that support TE decisions (EDAs).
+ *
+ * See "EDABinaryClassifierFromWeka" for an implementation example.
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public interface EDAClassifierAbstraction {
+
+ /**
+ * @param featureVector
+ * @return DecisionLabelWithConfidence
+ */
+ public DecisionLabelWithConfidence classifyInstance(Vector featureVector) throws ClassifierException;
+
+ /**
+ * @param goldData
+ */
+ public void createClassifierModel(List goldData) throws ClassifierException;
+
+ /**
+ * @param path
+ * @throws ClassifierException
+ */
+ public void storeClassifierModel(File path) throws ClassifierException;
+
+ /**
+ * @param path
+ * @throws ClassifierException
+ */
+ public void loadClassifierModel(File path) throws ClassifierException;
+
+ /**
+ * Evaluate currently trained classifier and returns a list of double values where it holds;
+ * (accuracy, f1, prec, recall, true positive ratio, true negative ratio)
+ *
+ * @param goldData
+ * @throws ClassifierException
+ */
+ public List evaluateClassifier(List goldData) throws ClassifierException;
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/FeatureValue.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/FeatureValue.java
new file mode 100644
index 00000000..e843b111
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/FeatureValue.java
@@ -0,0 +1,30 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
+
+
+
+/**
+ * A class that represents one Feature value, for classifier abstraction
+ * Relies on Value class.
+ *
+ * @author Tae-Gil Noh
+ */
+public class FeatureValue extends Value {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1413295719580599625L;
+
+ public FeatureValue(double d) {
+ super(d);
+ }
+
+ public FeatureValue(Enum> e) {
+ super(e);
+ }
+
+ public FeatureValue(Boolean b) {
+ super(b);
+ }
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/LabeledInstance.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/LabeledInstance.java
new file mode 100644
index 00000000..7575f14c
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/LabeledInstance.java
@@ -0,0 +1,27 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
+
+import java.util.Vector;
+
+import eu.excitementproject.eop.common.DecisionLabel;
+
+public class LabeledInstance {
+
+ public LabeledInstance(DecisionLabel goldLabel, Vector featureVector) {
+
+ this.label = goldLabel;
+ this.featureVector = featureVector;
+ }
+
+ public DecisionLabel getLabel()
+ {
+ return this.label;
+ }
+
+ public Vector getFeatureVector()
+ {
+ return this.featureVector;
+ }
+
+ private final DecisionLabel label;
+ private final Vector featureVector;
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ParameterValue.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ParameterValue.java
new file mode 100644
index 00000000..2ed975da
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ParameterValue.java
@@ -0,0 +1,76 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
+
+/**
+ * A class that represents one Parameter value
+ * The type is used in P1EDA as a representation of a parameter value.
+ *
+ * @author Tae-Gil Noh
+ */
+
+public class ParameterValue extends Value {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3934660978437533820L;
+ /**
+ * Constructor for initializing a ParameterValue
+ * with double. Range of the parameter will be given
+ * from default. (0 ~ 1)
+ *
+ * @param d
+ */
+ public ParameterValue(double val) {
+ super(val);
+ this.rangeMin = DEFAULT_MIN;
+ this.rangeMax = DEFAULT_MAX;
+ }
+
+ /**
+ * Constructor for initializing a ParameterValue
+ * with double. This constructor enables you to set
+ * min/max range of the double value of this parameter.
+ *
+ * @param val
+ * @param rangeMin
+ * @param rangeMax
+ */
+ public ParameterValue(double val, double rangeMin, double rangeMax)
+ {
+ super(val);
+ this.rangeMin = rangeMin;
+ this.rangeMax = rangeMax;
+ }
+
+ public ParameterValue(Enum> e) {
+ super(e);
+ rangeMin = null;
+ rangeMax = null;
+ }
+
+ public ParameterValue(Boolean b) {
+ super(b);
+ rangeMin = null;
+ rangeMax = null;
+ }
+
+ public double getRangeMin()
+ {
+ return rangeMin;
+ }
+
+ public double getRangeMax()
+ {
+ return rangeMax;
+ }
+
+ // Range (min and max values) of the parameter value
+ // the values are only meaningful when getValueType() == ValueType.DOUBLE
+ private final Double rangeMin;
+ private final Double rangeMax;
+
+ // Default values
+ private final double DEFAULT_MIN = 0.0;
+ private final double DEFAULT_MAX = 1.0;
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/Value.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/Value.java
new file mode 100644
index 00000000..0e041ce2
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/Value.java
@@ -0,0 +1,109 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
+
+import java.io.Serializable;
+
+/**
+ * This class expresses a "value" that can be either a Boolean, a double number, or a nominal value.
+ *
+ * The main usage of this class is to be represented as one "feature value", or one "parameter value".
+ *
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public class Value implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6413857523514908870L;
+
+ public Value(double d)
+ {
+ dValue = d;
+ bValue = null;
+ nValue = null;
+ type = ValueType.DOUBLE;
+ }
+
+ public Value(Enum> e)
+ {
+ dValue = null;
+ bValue = null;
+ nValue = e;
+ type = ValueType.NOMINAL;
+ }
+
+ public Value(Boolean b)
+ {
+ dValue = null;
+ bValue = b;
+ nValue = null;
+ type = ValueType.BOOLEAN;
+ }
+
+ // getters
+
+ public Boolean getBooleanValue() throws ValueException
+ {
+ if (type != ValueType.BOOLEAN)
+ {
+ throw new ValueException("Boolean value requested, while the value is not a boolean");
+ }
+ return bValue;
+ }
+
+ public Double getDoubleValue() throws ValueException
+ {
+ if (type != ValueType.DOUBLE)
+ {
+ throw new ValueException("Double value requested, while the value is not a double");
+ }
+ return dValue;
+ }
+
+ public Enum> getNominalValue() throws ValueException
+ {
+ if (type != ValueType.NOMINAL)
+ {
+ throw new ValueException("Nominal value requested, while the value is not a Nominal");
+ }
+ return nValue;
+ }
+
+ public ValueType getValueType()
+ {
+ return this.type;
+ }
+
+ // overriding toString
+ @Override
+ public String toString()
+ {
+ if (type == ValueType.BOOLEAN)
+ {
+ return bValue.toString();
+ }
+ else if (type == ValueType.DOUBLE)
+ {
+ return dValue.toString();
+ }
+ else // (type == ValueType.NOMINAL)
+ {
+ return nValue.toString();
+ }
+ }
+
+ // private data
+
+ private final ValueType type;
+ private final Double dValue;
+ private final Boolean bValue;
+ private final Enum> nValue;
+
+ public enum ValueType
+ {
+ DOUBLE, BOOLEAN, NOMINAL
+ }
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ValueException.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ValueException.java
new file mode 100644
index 00000000..b6f86192
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/ValueException.java
@@ -0,0 +1,19 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
+
+public class ValueException extends Exception {
+
+ private static final long serialVersionUID = -3913760857316479052L;
+
+ public ValueException(String message) {
+ super(message);
+ }
+
+ public ValueException(Throwable cause) {
+ super(cause);
+ }
+
+ public ValueException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/package-info.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/package-info.java
new file mode 100644
index 00000000..cc3bb195
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/subs/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * This package holds several data structures and support classes for P1EDA.
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda.subs;
\ No newline at end of file
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/templates/package-info.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/templates/package-info.java
new file mode 100644
index 00000000..f29ebf83
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/templates/package-info.java
@@ -0,0 +1,8 @@
+/**
+ *
+ */
+/**
+ * @author tailblues
+ *
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda.templates;
\ No newline at end of file
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/tools/CompareTwoEDAs.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/tools/CompareTwoEDAs.java
new file mode 100644
index 00000000..dfdbb366
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/tools/CompareTwoEDAs.java
@@ -0,0 +1,207 @@
+package eu.excitementproject.eop.alignmentedas.p1eda.tools;
+
+import java.io.File;
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.TOP;
+
+import eu.excitement.type.entailment.Pair;
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.sandbox.WithVO;
+import eu.excitementproject.eop.alignmentedas.p1eda.sandbox.WithoutVO;
+import eu.excitementproject.eop.common.DecisionLabel;
+import eu.excitementproject.eop.common.EDABasic;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.common.TEDecision;
+import eu.excitementproject.eop.lap.LAPException;
+import eu.excitementproject.eop.lap.PlatformCASProber;
+
+/**
+ * This class holds some static methods that are useful, or needed to
+ * compare and visualize differences between two different (P1) EDAs
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public class CompareTwoEDAs {
+
+ // TODO: Two lists output? instead of one? a.) improved on EDA2. b.) degraded on EDA2.
+ // TODO: startTraining(XML file?, modelToStore)? (on template side)
+ // TODO: include training...
+
+
+ public static void main(String[] args)
+ {
+ try {
+ P1EDATemplate withVO = new WithVO();
+ P1EDATemplate withoutVO = new WithoutVO();
+
+ withVO.initialize(new File("target/withVO.cmodel"));
+ withoutVO.initialize(new File("target/withoutVO.cmodel"));
+
+ logDiffPairs(withVO, withoutVO, new File("target/testingXmis"));
+ }
+ catch (Exception e)
+ {
+ System.err.println("Run stopped with Exception: " + e.getMessage());
+ }
+ }
+
+
+
+
+ /**
+ * Pass two initialized (ready to be call process()) EDAs,
+ * and one dir Path to XMI files.
+ *
+ * The utility will print out to Logger; all pair IDs that the two given
+ * EDAs did *not* agree.
+ *
+ * @param eda1
+ * @param eda2
+ * @param dirXMITestSet
+ */
+ static public void logDiffPairs(EDABasic extends TEDecision> eda1, EDABasic extends TEDecision> eda2, File dirXMITestSet) throws Exception
+ {
+ // well. Run each of the XMI pairs on two EDAs, and keep the
+ // pairID, and results.
+ // oh, by the way, keep general accuracy too. ...
+
+ HashMap diffPairs = new HashMap(); // diffPairs.get("id") = "eda 1 result (confidence), eda2 result(confidence), gold result"
+ int countEda1Correct = 0;
+ int countEda2Correct = 0;
+ int countTotalPair = 0;
+
+ File[] files = dirXMITestSet.listFiles();
+
+ // for each XMI ...
+ for(File f : files)
+ {
+ // sanity check first
+ logger.info("Working with file " + f.getName());
+ if(!f.isFile())
+ { // no ...
+ logger.warn(f.toString() + " is not a file... ignore this");
+ continue;
+ }
+ if(!f.getName().toLowerCase().endsWith("xmi")) // let's trust name, if it does not end with XMI, pass
+ {
+ logger.warn(f.toString() + " is not a XMI file... ignoring this");
+ continue;
+ }
+
+ // load XMI to two CASes
+ // (Note that we can't share CASes between the two EDAs. Alignments are being added,
+ // and a CAs is updated with run of alignment based EDA process() call.
+
+ JCas pairForEDA1 = null;
+ JCas pairForEDA2 = null;
+ try {
+ pairForEDA1 = PlatformCASProber.probeXmi(f, null);
+ pairForEDA2 = PlatformCASProber.probeXmi(f, null);
+ }
+ catch (LAPException le)
+ {
+ logger.warn("File " + f.toString() + " looks like XMI file, but its contents are *not* proper EOP EDA JCas");
+ throw new EDAException("failed to read XMI file into a JCas", le);
+ }
+
+ // get pair ID and gold annotation
+ String pairId = getTEPairID(pairForEDA1);
+ logger.info("comparing two edas on pair " + pairId);
+ DecisionLabel gold = getGoldLabel(pairForEDA1);
+
+ // get the result from the two edas
+ TEDecision eda1s = eda1.process(pairForEDA1);
+ TEDecision eda2s = eda2.process(pairForEDA2);
+
+ // update counters
+ countTotalPair ++;
+ if (eda1s.getDecision() == gold)
+ {
+ countEda1Correct++;
+ }
+
+ if (eda2s.getDecision() == gold)
+ {
+ countEda2Correct++;
+ }
+
+ // update diff list
+ if (! (eda1s.getDecision() == eda2s.getDecision()))
+ {
+ logger.debug("different results on pair " + pairId + ": " + eda1s.getDecision().toString() + ", " + eda2s.getDecision().toString());
+ diffPairs.put(pairId, eda1s.getDecision().toString() + ", " + eda2s.getDecision().toString() + " (gold: " + gold.toString() + ")");
+ }
+
+ }
+
+ logger.info("In total, " + countTotalPair + " pairs tested");
+ logger.info("eda1: " + countEda1Correct + " / " + countTotalPair);
+ logger.info("eda2: " + countEda2Correct + " / " + countTotalPair);
+ logger.info("Diff list is:");
+
+ for (String s : diffPairs.keySet())
+ {
+ logger.info(s + ": " + diffPairs.get(s));
+ }
+
+ }
+
+ private static Logger logger = Logger.getLogger(CompareTwoEDAs.class);
+
+ public static DecisionLabel getGoldLabel(JCas aJCas) throws EDAException
+ {
+ String labelString;
+ DecisionLabel labelEnum;
+
+ FSIterator iter = aJCas.getJFSIndexRepository().getAllIndexedFS(Pair.type);
+ if (iter.hasNext())
+ {
+ Pair p = (Pair) iter.next();
+ labelString = p.getGoldAnswer();
+
+ if (labelString == null) // there is no gold answer annotated in this Pair
+ return null;
+
+ labelEnum = DecisionLabel.getLabelFor(labelString);
+
+ if (iter.hasNext())
+ {
+ logger.warn("This JCas has more than one TE Pairs: This P1EDA template only processes single-pair inputs. Any additional pairs are being ignored, and only the first Pair will be processed.");
+ }
+ return labelEnum;
+ }
+ else
+ {
+ throw new EDAException("Input CAS is not well-formed CAS as EOP EDA input: missing TE pair");
+ }
+ }
+
+ public static String getTEPairID(JCas aJCas) throws EDAException
+ {
+ String id = null;
+
+ // check entailment pair,
+ FSIterator iter = aJCas.getJFSIndexRepository().getAllIndexedFS(Pair.type);
+ if (iter.hasNext())
+ {
+ Pair p = (Pair) iter.next();
+ id = p.getPairID();
+
+ if (iter.hasNext())
+ {
+ logger.warn("This JCas has more than one TE Pairs: This P1EDA template only processes single-pair inputs. Any additional pairs are being ignored, and only the first Pair will be processed.");
+ }
+ return id;
+ }
+ else
+ {
+ throw new EDAException("Input CAS is not well-formed CAS as EOP EDA input: missing TE pair");
+ }
+ }
+
+}
diff --git a/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/tools/package-info.java b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/tools/package-info.java
new file mode 100644
index 00000000..9455b460
--- /dev/null
+++ b/alignmentedas/src/main/java/eu/excitementproject/eop/alignmentedas/p1eda/tools/package-info.java
@@ -0,0 +1,9 @@
+
+/**
+ * Some tools classes that are used to test, evaluate, or experiment with
+ * P1 EDAs
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+package eu.excitementproject.eop.alignmentedas.p1eda.tools;
\ No newline at end of file
diff --git a/alignmentedas/src/test/java/eu/excitement/type/alignment/InMemoryCasTest.java b/alignmentedas/src/test/java/eu/excitement/type/alignment/InMemoryCasTest.java
new file mode 100644
index 00000000..546e6993
--- /dev/null
+++ b/alignmentedas/src/test/java/eu/excitement/type/alignment/InMemoryCasTest.java
@@ -0,0 +1,120 @@
+package eu.excitement.type.alignment;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.uima.jcas.JCas;
+
+import eu.excitementproject.eop.alignmentedas.P1EdaRTERunner;
+import eu.excitementproject.eop.lap.LAPException;
+import eu.excitementproject.eop.lap.PlatformCASProber;
+import eu.excitementproject.eop.lap.dkpro.MaltParserEN;
+import eu.excitementproject.eop.lap.dkpro.TreeTaggerEN;
+import eu.excitementproject.eop.lap.implbase.LAP_ImplBase;
+
+/**
+ * Test code for, how much memory does it require to load 800 CASes in memory,
+ * for parameter optimization...
+ *
+ * Okay. 800 CASes can be handled in 8G memory system...
+ * (with just LAP annotations... )
+ *
+ * For now, we have no fast "binary" serialization methods available (e.g. requires later DKPro)
+ * So, let's proceed with this memory version for "parameter (of evaluateAlignment / Feature extractor)"
+ * optimizers.
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+@SuppressWarnings("unused")
+public class InMemoryCasTest {
+
+// public InMemoryCasTest() {
+// }
+
+
+ public static void main(String[] args) {
+
+ // logger
+ BasicConfigurator.configure();
+ Logger.getRootLogger().setLevel(Level.INFO);
+
+ try {
+
+ // generate Xmis
+ //LAP_ImplBase lap = new TreeTaggerEN();
+ LAP_ImplBase lap = new MaltParserEN();
+ File rteInputXML = new File("../core/src/main/resources/data-set/English_dev.xml");
+ File xmiDir = new File ("target/xmiTest/");
+ P1EdaRTERunner.runLAPForXmis(lap, rteInputXML, xmiDir);
+
+ logger.info("***"); logger.info("***"); logger.info("***");
+
+ // load Xmis
+ List jCasList = loadXmisAsJCasList(xmiDir);
+ System.out.println("JCas list loaded : " + jCasList.size() + " instances.");
+
+ }
+ catch (Exception e)
+ {
+ logger.error(e.getMessage());
+ System.exit(1);
+ }
+ }
+
+
+ public static List loadXmisAsJCasList(File xmiDir)
+ {
+ List casList = new ArrayList();
+
+ // walk each XMI files in the Directory ...
+ File[] files = xmiDir.listFiles();
+ if (files == null)
+ {
+ logger.warn("Path " + xmiDir.getAbsolutePath() + " does not hold XMI files");
+ System.exit(1);
+ }
+
+ for (File f : files)
+ {
+ // is it a XMI file?
+ //
+
+ logger.info("Working with file " + f.getName());
+ if(!f.isFile())
+ { // no ...
+ logger.warn(f.toString() + " is not a file... ignore this");
+ continue;
+ }
+ if(!f.getName().toLowerCase().endsWith("xmi")) // let's trust name, if it does not end with XMI, pass
+ {
+ logger.warn(f.toString() + " is not a XMI file... ignoring this");
+ continue;
+ }
+
+ // So, we have an XMI file. Load in to CAS
+ JCas aTrainingPair = null;
+ try {
+ aTrainingPair = PlatformCASProber.probeXmi(f, null);
+ }
+ catch (LAPException le)
+ {
+ logger.warn("File " + f.toString() + " looks like XMI file, but its contents are *not* proper EOP EDA JCas");
+ System.exit(1);
+ }
+ casList.add(aTrainingPair);
+ }
+
+ logger.info("Loaded " + casList.size() + " XMI files as JCas...");
+ return casList;
+ }
+
+ public static Logger logger = Logger.getLogger(InMemoryCasTest.class);
+
+
+
+}
diff --git a/alignmentedas/src/test/java/eu/excitement/type/alignment/LinkUtilsTest.java b/alignmentedas/src/test/java/eu/excitement/type/alignment/LinkUtilsTest.java
new file mode 100644
index 00000000..e3d7959d
--- /dev/null
+++ b/alignmentedas/src/test/java/eu/excitement/type/alignment/LinkUtilsTest.java
@@ -0,0 +1,108 @@
+package eu.excitement.type.alignment;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.jcas.JCas;
+import org.junit.Assume;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.utilities.uima.UimaUtils;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.core.component.alignment.phraselink.MeteorPhraseLinkerEN;
+import eu.excitementproject.eop.lap.dkpro.OpenNLPTaggerEN;
+import eu.excitementproject.eop.lap.dkpro.TreeTaggerEN;
+
+@SuppressWarnings("unused")
+public class LinkUtilsTest {
+
+ @Ignore
+ @Test
+ public void test() {
+ // Set Log4J for the test
+ BasicConfigurator.resetConfiguration();
+ BasicConfigurator.configure();
+ Logger.getRootLogger().setLevel(Level.INFO); // for UIMA (hiding < INFO)
+ Logger testlogger = Logger.getLogger("eu.excitement.type.alignment.LunkUtilsTest");
+
+
+ // prepare a lemmatizer
+ TreeTaggerEN lemmatizer = null;
+ try
+ {
+ JCas test = UimaUtils.newJcas();
+ lemmatizer = new TreeTaggerEN();
+ lemmatizer.generateSingleTHPairCAS("this is a test.", "TreeTagger in sight?");
+ }
+ catch (Exception e)
+ {
+ // check if this is due to missing TreeTagger binary and model.
+ // In such a case, we just skip this test.
+ // (see /lap/src/scripts/treetagger/README.txt to how to install TreeTagger)
+ if (ExceptionUtils.getRootCause(e) instanceof java.io.IOException)
+ {
+ testlogger.info("Skipping the test: TreeTagger binary and/or models missing. \n To run this testcase, TreeTagger installation is needed. (see /lap/src/scripts/treetagger/README.txt)");
+ Assume.assumeTrue(false); // we won't test this test case any longer.
+ }
+
+ fail(e.getMessage());
+ }
+
+ // prepare aJCas with two different aligners
+ AlignmentComponent idtLinker = null;
+ AlignmentComponent phraseLinker = null;
+ JCas aJCas = null;
+ try {
+ idtLinker = new IdenticalLemmaPhraseLinker();
+ phraseLinker = new MeteorPhraseLinkerEN();
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+ try {
+ // RTE3 test pair 17 (some links in both Meteor & same lemma linker)
+ aJCas = lemmatizer.generateSingleTHPairCAS(
+ "David Golinkin is single-handedly responsible for uncovering and re-publishing dozens of responsa of the Committee on Jewish Law and Standards of the Rabbinical Assembly, making them available to the general public in a three-volume set.",
+ "David Golinkin is the author of dozen of responsa of the Committee on Jewish Law and Standards of the Rabbinical Assembly.");
+ phraseLinker.annotate(aJCas);
+ idtLinker.annotate(aJCas);
+ //LinkUtils.dumpTokenLevelLinks(aJCas, System.out);
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ // test selectLinksWith
+ try {
+ selectLinksWithTest(aJCas);
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ }
+
+ private void selectLinksWithTest(JCas aJCas) throws CASException
+ {
+ List linksWithMeteor = LinkUtils.selectLinksWith(aJCas, "MeteorPhraseLink");
+ assertEquals(4, linksWithMeteor.size());
+ // System.out.println(linksWithMeteor.size());
+ List linksWithIdentical = LinkUtils.selectLinksWith(aJCas, "IdenticalLemmas");
+ assertEquals(18, linksWithIdentical.size());
+ // System.out.println(linksWithIdentical.size()) ;
+
+ }
+
+
+}
diff --git a/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/MinimalP1EDATest.java b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/MinimalP1EDATest.java
new file mode 100644
index 00000000..315852b1
--- /dev/null
+++ b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/MinimalP1EDATest.java
@@ -0,0 +1,107 @@
+package eu.excitementproject.eop.alignmentedas;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.uima.jcas.JCas;
+import org.junit.Assume;
+import org.junit.Test;
+
+import eu.excitementproject.eop.alignmentedas.p1eda.P1EDATemplate;
+import eu.excitementproject.eop.alignmentedas.p1eda.TEDecisionWithAlignment;
+import eu.excitementproject.eop.alignmentedas.p1eda.instances.MinimalP1EDA;
+import eu.excitementproject.eop.common.EDAException;
+import eu.excitementproject.eop.lap.LAPException;
+import eu.excitementproject.eop.lap.PlatformCASProber;
+import eu.excitementproject.eop.lap.dkpro.TreeTaggerEN;
+
+public class MinimalP1EDATest {
+
+ @Test
+ public void test() {
+
+ // Set Log4J for the test
+ BasicConfigurator.resetConfiguration();
+ BasicConfigurator.configure();
+ Logger.getRootLogger().setLevel(Level.DEBUG); // set INFO to hide Debug
+ testlogger = Logger.getLogger(getClass().getName());
+
+ // prepare a lemmatizer
+ TreeTaggerEN lap = null;
+
+ try
+ {
+ lap = new TreeTaggerEN();
+ lap.generateSingleTHPairCAS("this is a test.", "TreeTagger in sight?");
+ }
+ catch (Exception e)
+ {
+ // check if this is due to missing TreeTagger binary and model.
+ // In such a case, we just skip this test.
+ // (see /lap/src/scripts/treetagger/README.txt to how to install TreeTagger)
+ if (ExceptionUtils.getRootCause(e) instanceof java.io.IOException)
+ {
+ testlogger.info("Skipping the test: TreeTagger binary and/or models missing. \n To run this testcase, TreeTagger installation is needed. (see /lap/src/scripts/treetagger/README.txt)");
+ Assume.assumeTrue(false); // we won't test this test case any longer.
+ }
+ }
+
+ try {
+ doMinimalTest(lap);
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ }
+
+ public void doMinimalTest(TreeTaggerEN lap) throws EDAException, LAPException
+ {
+
+ // get an instance of the EDA
+ P1EDATemplate eda = new MinimalP1EDA();
+
+ // Make the "very simple", "minimal" two training data.
+ JCas cas1 = lap.generateSingleTHPairCAS("The train was uncomfortable", "the train was comfortable", "NONENTAILMENT");
+ JCas cas2 = lap.generateSingleTHPairCAS("The person is hired as a postdoc.","The person is hired as a postdoc.", "ENTAILMENT");
+
+ File xmiDir = new File("target/xmis/");
+ if (!xmiDir.exists())
+ {
+ xmiDir.mkdirs();
+ }
+ File modelBaseName = new File("target/simple");
+
+ PlatformCASProber.storeJCasAsXMI(cas1, new File("target/xmis/train1.xmi"));
+ PlatformCASProber.storeJCasAsXMI(cas2, new File("target/xmis/train2.xmi"));
+
+ // Okay. Start Training
+ eda.startTraining(xmiDir, modelBaseName);
+
+ // ask something?
+ JCas eopJCas = lap.generateSingleTHPairCAS("This was hello world.", "This is hello world.");
+ eda.process(eopJCas);
+
+ // ask another
+ eopJCas = lap.generateSingleTHPairCAS("This is a very simple configuration.", "This is in fact a complex configuration.");
+ TEDecisionWithAlignment d1 = eda.process(eopJCas);
+ testlogger.info(d1.getDecision() + ", " + d1.getConfidence());
+
+ // load Model test
+ MinimalP1EDA eda2 = new MinimalP1EDA();
+ eda2.initialize(modelBaseName);
+ TEDecisionWithAlignment d2 = eda2.process(eopJCas);
+ assertEquals(d2.getDecision(), d1.getDecision());
+ assertEquals(d2.getConfidence(), d1.getConfidence(), 0.01);
+
+ }
+
+ public static Logger testlogger;
+
+}
diff --git a/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/scorers/SimpleNerCoverageCounterTest.java b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/scorers/SimpleNerCoverageCounterTest.java
new file mode 100644
index 00000000..bcf7956d
--- /dev/null
+++ b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/scorers/SimpleNerCoverageCounterTest.java
@@ -0,0 +1,81 @@
+package eu.excitementproject.eop.alignmentedas.scorers;
+
+import static org.junit.Assert.*;
+
+import java.util.Vector;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.uima.jcas.JCas;
+import org.junit.Assume;
+import org.junit.Test;
+
+import eu.excitement.type.alignment.LinkUtils;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleProperNounCoverageCounter;
+//import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.lap.dkpro.TreeTaggerEN;
+
+public class SimpleNerCoverageCounterTest {
+
+ @Test
+ public void test() {
+ // Set Log4J for the test
+ BasicConfigurator.resetConfiguration();
+ BasicConfigurator.configure();
+ Logger.getRootLogger().setLevel(Level.DEBUG); // for UIMA (hiding < INFO)
+ Logger testlogger = Logger.getLogger(getClass().getName());
+
+ // prepare a lemmatizer
+ TreeTaggerEN lemmatizer = null;
+ JCas aJCas = null;
+ try
+ {
+ lemmatizer = new TreeTaggerEN();
+ aJCas = lemmatizer.generateSingleTHPairCAS("John Fitzgerald Kennedy, the 35th President of the United States, was assassinated at 12:30 p.m. Central Standard Time (18:30 UTC) on Friday, November 22, 1963, in Dealey Plaza, Dallas, Texas.", "John F. Kennedy was assasinated by Lee Harvey Oswald at the state of Dallas.");
+ }
+ catch (Exception e)
+ {
+ // check if this is due to missing TreeTagger binary and model.
+ // In such a case, we just skip this test.
+ // (see /lap/src/scripts/treetagger/README.txt to how to install TreeTagger)
+ if (ExceptionUtils.getRootCause(e) instanceof java.io.IOException)
+ {
+ testlogger.info("Skipping the test: TreeTagger binary and/or models missing. \n To run this testcase, TreeTagger installation is needed. (see /lap/src/scripts/treetagger/README.txt)");
+ Assume.assumeTrue(false); // we won't test this test case any longer.
+ }
+
+ fail(e.getMessage());
+ }
+
+ // annotate with identity
+ try {
+ AlignmentComponent idtLinker = new IdenticalLemmaPhraseLinker();
+ idtLinker.annotate(aJCas);
+ LinkUtils.dumpTokenLevelLinks(aJCas, System.out);
+
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ // and simple test.
+ ScoringComponent count1 = new SimpleProperNounCoverageCounter();
+ try {
+ Vector v = count1.calculateScores(aJCas);
+ testlogger.info(v.get(0));
+ testlogger.info(v.get(1));
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/scorers/SimpleWordCoverageCounterTest.java b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/scorers/SimpleWordCoverageCounterTest.java
new file mode 100644
index 00000000..917ee1a1
--- /dev/null
+++ b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/scorers/SimpleWordCoverageCounterTest.java
@@ -0,0 +1,108 @@
+package eu.excitementproject.eop.alignmentedas.scorers;
+
+import static org.junit.Assert.*;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.uima.jcas.JCas;
+import org.junit.Assume;
+import org.junit.Test;
+import org.uimafit.util.JCasUtil;
+
+import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;
+import eu.excitement.type.alignment.Link;
+import eu.excitement.type.alignment.LinkUtils;
+import eu.excitementproject.eop.alignmentedas.p1eda.scorers.SimpleWordCoverageCounter;
+import eu.excitementproject.eop.common.component.alignment.AlignmentComponent;
+import eu.excitementproject.eop.common.component.scoring.ScoringComponent;
+import eu.excitementproject.eop.core.component.alignment.phraselink.IdenticalLemmaPhraseLinker;
+import eu.excitementproject.eop.lap.dkpro.TreeTaggerEN;
+
+public class SimpleWordCoverageCounterTest {
+
+ @Test
+ public void test() {
+
+ // Set Log4J for the test
+ BasicConfigurator.resetConfiguration();
+ BasicConfigurator.configure();
+ Logger.getRootLogger().setLevel(Level.DEBUG); // for UIMA (hiding < INFO)
+ Logger testlogger = Logger.getLogger(getClass().getName());
+
+ // prepare a lemmatizer
+ TreeTaggerEN lemmatizer = null;
+ JCas aJCas = null;
+ try
+ {
+ lemmatizer = new TreeTaggerEN();
+ aJCas = lemmatizer.generateSingleTHPairCAS("Lovely TreeTagger test is in sight, or lovely goes not?", "Lovely goes a test.");
+ }
+ catch (Exception e)
+ {
+ // check if this is due to missing TreeTagger binary and model.
+ // In such a case, we just skip this test.
+ // (see /lap/src/scripts/treetagger/README.txt to how to install TreeTagger)
+ if (ExceptionUtils.getRootCause(e) instanceof java.io.IOException)
+ {
+ testlogger.info("Skipping the test: TreeTagger binary and/or models missing. \n To run this testcase, TreeTagger installation is needed. (see /lap/src/scripts/treetagger/README.txt)");
+ Assume.assumeTrue(false); // we won't test this test case any longer.
+ }
+
+ fail(e.getMessage());
+ }
+
+ // annotate with identity
+ try {
+ AlignmentComponent idtLinker = new IdenticalLemmaPhraseLinker();
+ idtLinker.annotate(aJCas);
+ LinkUtils.dumpTokenLevelLinks(aJCas, System.out);
+
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ // get first token of H, and test the method
+ // filterLinksWithTargetsIncluding
+
+ try {
+ JCas hView = aJCas.getView("HypothesisView");
+ Collection tokens = JCasUtil.select(hView, Token.class);
+ List links = LinkUtils.selectLinksWith(aJCas, (String) null);
+ Iterator ti = tokens.iterator();
+ ti.next(); // first token
+ Token t = ti.next(); // second token
+ List filteredLinks = SimpleWordCoverageCounter.filterLinksWithTargetsIncluding(links, t);
+ //System.out.println(filteredLinks.size());
+ assertEquals(1, filteredLinks.size());
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Okay, Let's do some coverage test.
+ ScoringComponent count1 = new SimpleWordCoverageCounter(null); // count all
+ try {
+ Vector v = count1.calculateScores(aJCas);
+ testlogger.info(v.get(0));
+ testlogger.info(v.get(1));
+ testlogger.info(v.get(2));
+ testlogger.info(v.get(3));
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/subs/EDABinaryClassifierFromWekaTest.java b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/subs/EDABinaryClassifierFromWekaTest.java
new file mode 100644
index 00000000..1761ba44
--- /dev/null
+++ b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/subs/EDABinaryClassifierFromWekaTest.java
@@ -0,0 +1,118 @@
+package eu.excitementproject.eop.alignmentedas.subs;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.junit.Test;
+
+import eu.excitementproject.eop.alignmentedas.p1eda.classifiers.EDABinaryClassifierFromWeka;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.DecisionLabelWithConfidence;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.EDAClassifierAbstraction;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.LabeledInstance;
+import eu.excitementproject.eop.common.DecisionLabel;
+
+public class EDABinaryClassifierFromWekaTest {
+
+ @Test
+ public void test() {
+ // prepare a training set
+ List trainingData = new ArrayList();
+
+ Vector fv1 = new Vector();
+ fv1.addElement(new FeatureValue(1.0));
+ fv1.addElement(new FeatureValue(0.5));
+ fv1.addElement(new FeatureValue(MyColor.gray));
+
+ LabeledInstance ins1 = new LabeledInstance(DecisionLabel.Entailment, fv1);
+ trainingData.add(ins1);
+
+
+ // init one and ask it to train ...
+ EDAClassifierAbstraction classifier = null;
+ try {
+ classifier = new EDABinaryClassifierFromWeka();
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ try {
+ classifier.createClassifierModel(trainingData);
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ // classify an instance ...
+
+ Vector fv2 = new Vector();
+ fv2.addElement(new FeatureValue(0.5));
+ fv2.addElement(new FeatureValue(0.1));
+ fv2.addElement(new FeatureValue(MyColor.blue));
+
+ try {
+ DecisionLabelWithConfidence result = classifier.classifyInstance(fv2);
+ System.out.println(result.getLabel().toString());
+ System.out.println(result.getConfidence());
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ // evaluate classifier ...
+ try {
+ List eval = classifier.evaluateClassifier(trainingData);
+ System.out.println("acc: " + eval.get(0));
+ System.out.println("f1 :" + eval.get(1));
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+
+ // store model,
+ File f = new File("target/default1.model");
+ try {
+ classifier.storeClassifierModel(f);
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ // load model on a new instance ...
+ // and ask again ...
+ EDAClassifierAbstraction classifier2 = null;
+ try {
+ classifier2 = new EDABinaryClassifierFromWeka();
+ classifier2.loadClassifierModel(f);
+ DecisionLabelWithConfidence result = classifier.classifyInstance(fv2);
+ System.out.println(result.getLabel().toString());
+ System.out.println(result.getConfidence());
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ f.delete();
+
+ }
+
+ public enum MyColor
+ {
+ blue,
+ gray,
+ black
+ }
+
+}
diff --git a/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/subs/ValueTest.java b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/subs/ValueTest.java
new file mode 100644
index 00000000..2ac56552
--- /dev/null
+++ b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/subs/ValueTest.java
@@ -0,0 +1,44 @@
+package eu.excitementproject.eop.alignmentedas.subs;
+
+//import static org.junit.Assert.*;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import eu.excitementproject.eop.alignmentedas.p1eda.subs.FeatureValue;
+
+public class ValueTest {
+
+ @Test
+ public void test() {
+
+
+ FeatureValue v1 = new FeatureValue(MyNominalValues.NOMINAL1);
+
+ try
+ {
+ Enum> e = v1.getNominalValue();
+ // we can access the enum value it self..
+ System.out.println(e.toString());
+
+ // and also all the other values permitted in that enum.
+ // this is essential for training data (of nominal values)
+ Enum>[] elist = e.getClass().getEnumConstants();
+ for (Enum> x : elist)
+ {
+ System.out.println(x);
+ }
+ }
+ catch (Exception e)
+ {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ public enum MyNominalValues {
+ NOMINAL1,
+ NOMINAL2,
+ NOMINAL3
+ }
+
+}
diff --git a/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/temptest/package-info.java b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/temptest/package-info.java
new file mode 100644
index 00000000..71ac8339
--- /dev/null
+++ b/alignmentedas/src/test/java/eu/excitementproject/eop/alignmentedas/temptest/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * Temporary tests used for building T1EDA ...
+ *
+ */
+package eu.excitementproject.eop.alignmentedas.temptest;
\ No newline at end of file
diff --git a/biutee/pom.xml b/biutee/pom.xml
index 5f49ae4b..05cdcbd9 100644
--- a/biutee/pom.xml
+++ b/biutee/pom.xml
@@ -4,7 +4,7 @@
eu.excitementprojecteop
- 1.1.3
+ 1.1.4biuteebiutee
@@ -36,7 +36,7 @@
eu.excitementprojecttransformations
- 1.1.3
+ 1.1.4
diff --git a/common/pom.xml b/common/pom.xml
index ee591933..715de149 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -3,7 +3,7 @@
eu.excitementprojecteop
- 1.1.3
+ 1.1.4commoncommon
diff --git a/lap/src/main/java/eu/excitementproject/eop/lap/DummyAE.java b/common/src/main/java/eu/excitement/type/DummyAE.java
similarity index 94%
rename from lap/src/main/java/eu/excitementproject/eop/lap/DummyAE.java
rename to common/src/main/java/eu/excitement/type/DummyAE.java
index 18ef2c93..f11f8fd3 100644
--- a/lap/src/main/java/eu/excitementproject/eop/lap/DummyAE.java
+++ b/common/src/main/java/eu/excitement/type/DummyAE.java
@@ -1,4 +1,4 @@
-package eu.excitementproject.eop.lap;
+package eu.excitement.type;
import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
diff --git a/common/src/main/java/eu/excitement/type/alignment/GroupLabelDomainLevel.java b/common/src/main/java/eu/excitement/type/alignment/GroupLabelDomainLevel.java
new file mode 100644
index 00000000..ef436990
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/alignment/GroupLabelDomainLevel.java
@@ -0,0 +1,43 @@
+package eu.excitement.type.alignment;
+
+/**
+ * This Enum is defined to show the "group" of a specific alignment.Link instance.
+ * This file defines "Domain Level" semantic group labels. By domain level, we assume different granularity,
+ * or different source: such as "lexical level" grouping, or "syntactic level" grouping, or "predicate level" grouping,
+ * They are different to generic "inference level", and we call such as domain (domain of syntactic, domain of lexical, etc).
+ *
+ * The enum values are used in Link class (the class that represents alignment.Link CAS type).
+ * See addGroupLabel() methods and getGroupLabelDomainLevel() methods in Link class; they are the main users of the
+ * enum defined here.
+ *
+ * NOTE: using semantic group label is optional - but it is recommended that an aligner should add (at least)
+ * inference-level semantic labels.
+ *
+ * NOTE: the enum class can be extended to reflect new domain (e.g. predicate level relations in the future, etc)
+ *
+ * @author Tae-Gil Noh
+ * @since September 2014
+ */
+
+// Note: the following list has been first defined and proposed by BIU.
+// (although they are tuned a bit after some discussion)
+// See the following Google Doc to check the rational for the domain level
+// definitions, and how they are mapped to actual ontologies such as WordNet
+// and VerbOcean.
+// http://goo.gl/xlUm3h
+
+
+public enum GroupLabelDomainLevel {
+ SYNONYM,
+ HYPERNYM,
+ HYPONYM,
+ MERONYM,
+ HOLONYM,
+ CAUSE,
+ DERIVATIONALLY_RELATED,
+ HAPPENES_BEFORE,
+ ANTONYM,
+ SAME_PREDICATE_TRUTH,
+ OPPOSITE_PREDICATE_TRUTH,
+ SEMANTICALLY_RELATED,
+}
diff --git a/common/src/main/java/eu/excitement/type/alignment/GroupLabelInferenceLevel.java b/common/src/main/java/eu/excitement/type/alignment/GroupLabelInferenceLevel.java
new file mode 100644
index 00000000..af8b4e0d
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/alignment/GroupLabelInferenceLevel.java
@@ -0,0 +1,29 @@
+package eu.excitement.type.alignment;
+
+/**
+ *
+ * This Enum is defined to show the "group" of a specific alignment.Link instance.
+ * This file defines "Inference Level" semantic group labels.
+ *
+ * For example, is this link means Entailment relation establishing between the items that are linked?
+ * (such as, synonyms linked by a lexical aligner).
+ *
+ * This enum type defines "inference level" (or top-level) semantic group, such as "aligned targets are having relationship
+ * that is ..."
+ *
+ * The enum values are used in Link class (the class that represents alignment.Link CAS type).
+ * See addGroupLabel() methods and getGroupLabelInferenceLevel() methods in Link class; they are the main users of the
+ * enums defined here.
+ *
+ * NOTE: the enum class might be extended to reflect new top level inference relations for the future
+ * alignment.Links. But this enum should be kept stable, simple, and common enough; so, the semantic label
+ * would be actually used (both on annotating side and consumer (EDA) side).
+ *
+ * @author Tae-Gil Noh
+ * @since September 2014
+ */
+public enum GroupLabelInferenceLevel {
+ LOCAL_CONTRADICTION,
+ LOCAL_ENTAILMENT,
+ LOCAL_SIMILARITY
+}
diff --git a/common/src/main/java/eu/excitement/type/alignment/Link.java b/common/src/main/java/eu/excitement/type/alignment/Link.java
index 16b36861..a66b652a 100644
--- a/common/src/main/java/eu/excitement/type/alignment/Link.java
+++ b/common/src/main/java/eu/excitement/type/alignment/Link.java
@@ -1,18 +1,20 @@
package eu.excitement.type.alignment;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.uima.cas.CASException;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.NonEmptyStringList;
import org.apache.uima.jcas.cas.TOP_Type;
-
import org.apache.uima.jcas.cas.StringList;
import org.apache.uima.jcas.tcas.Annotation;
/** - CAS type that links two Target.
- Multi-view type: a Link connects one target in T (TextView), the other target in H (HypothesisView).
-
The semantic of a "Link" is: The texts (or structures) pointed by "TSideTarget" and "HSideTarget" have a relation of "type", with the direction of "direction", on a strength of "strength".
-
We make no assumptions regarding what annotations are aligned by Link and Target types. One Target can be linked by an arbitrary number of Link, also a Target can group an arbitrary number of Annotations. Note that uima.tcas.Annotation is the super type of almost all CAS annotation data. Since a Target can group Annotation, it can group any type of annotations in CAS.
Some notes on Link type usage. (Indexing and setting begin - end)
@@ -216,26 +218,31 @@ public void setLinkInfo(String v) {
//*--------------*
//* Feature: groupLabel
- /** getter for groupLabel - gets TBDTBDTBDTBD
-
-TO BE DETERMINED.
-
-We will adopt "common semantic groups", such as "LOCAL-ENTAILMENT" links, or "LOCAL-CONTRADICTION" links, and so on. This field is for those "labels". Such labels are provided as "Convenience" tools --- to help the consumer modules of alignment.Link can classify various Links without hard-coding aliner Id or link's getIDs.
-
-Actual values for the labels will be updated. TBDTBDTBDTBD
+ /**
+ * Getter for groupLabel - Please do not use this method directly.
+ *
+ * Instead, Please use getGroupLabel methods that returns a Enum Set.
+ * (getGroupLabelInferenceLevel() and getGroupLabelDomainLevel()).
+ *
+ * This method retrieves the underlying StringList object, which is a linkedList.
+ * The wrapper methods getGroupLabel() for levels are better presented with Enums.
+ *
* @generated */
public StringList getGroupLabel() {
if (Link_Type.featOkTst && ((Link_Type)jcasType).casFeat_groupLabel == null)
jcasType.jcas.throwFeatMissing("groupLabel", "eu.excitement.type.alignment.Link");
return (StringList)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Link_Type)jcasType).casFeatCode_groupLabel)));}
- /** setter for groupLabel - sets TBDTBDTBDTBD
-
-TO BE DETERMINED.
-
-We will adopt "common semantic groups", such as "LOCAL-ENTAILMENT" links, or "LOCAL-CONTRADICTION" links, and so on. This field is for those "labels". Such labels are provided as "Convenience" tools --- to help the consumer modules of alignment.Link can classify various Links without hard-coding aliner Id or link's getIDs.
-
-Actual values for the labels will be updated. TBDTBDTBDTBD
+ /**
+ * setter for groupLabel - Please do not use this method directly.
+ *
+ * Instead, please use addGroupLabel method that accepts two Enum types.
+ * --- domain level group label and inference lavel group label.
+ *
+ * This method sets StringList object, which is a linkedList.
+ * The wrapper methods addGroupLabel() methods are better presented
+ * with Enums. Use those methods.
+ *
* @generated */
public void setGroupLabel(StringList v) {
if (Link_Type.featOkTst && ((Link_Type)jcasType).casFeat_groupLabel == null)
@@ -293,7 +300,147 @@ public Direction getDirection()
Direction dir = Direction.valueOf(getDirectionString());
return dir;
}
-
- }
+
+ /**
+ * One of the two getter method for Group Labels.
+ *
+ * This method returns the set of "Inference level" group labels that are added for this
+ * alignment.Link instance. See SemanticLabelInferenceLevel enum class, for checking what
+ * type of labels are there currently.
+ *
+ * @return set of inference level group labels.
+ */
+ public Set getGroupLabelsInferenceLevel()
+ {
+ Set result = new HashSet();
+
+ // iterate each of string, check, and add if it is.
+ NonEmptyStringList i = (NonEmptyStringList) this.getGroupLabel();
+
+ while(i != null)
+ {
+ String s = i.getHead();
+ i = (NonEmptyStringList) i.getTail();
+
+ GroupLabelInferenceLevel label = null;
+ try {
+ label = GroupLabelInferenceLevel.valueOf(s);
+ }
+ catch(IllegalArgumentException e)
+ {
+ continue; // this string is not one of this enum. pass.
+ }
+ result.add(label);
+ }
+ return result;
+ }
+
+ /**
+ * One of the two getter method for Group Labels.
+ *
+ * This method returns the set of "Domain level" group labels that are added for this
+ * alignment.Link instance. See SemanticLabelDomainLevel enum class, for checking what
+ * type of labels are there currently.
+ *
+ * @return set of domain level group labels.
+ */
+ public Set getGroupLabelsDomainLevel()
+ {
+ Set result = new HashSet();
+
+ // iterate each of string, check, and add if it is.
+ NonEmptyStringList i = (NonEmptyStringList) this.getGroupLabel();
+
+ while(i != null)
+ {
+ String s = i.getHead();
+ i = (NonEmptyStringList) i.getTail();
+
+ GroupLabelDomainLevel label = null;
+ try {
+ label = GroupLabelDomainLevel.valueOf(s);
+ }
+ catch(IllegalArgumentException e)
+ {
+ continue; // this string is not one of this enum. pass.
+ }
+ result.add(label);
+ }
+ return result;
+ }
+
+ /**
+ * Use this method to add one semantic group label (domain level).
+ * To add multiple labels, call this method multiple times with different labels.
+ *
+ * Adding semantic group label is optional, but can be helpful for the grouping of the
+ * Links for the consumer of the JCas. Thus, it is highly recommended that an aligner
+ * should add minimally the inference level group label, if applicable.
+ *
+ * This method adds one domain level group label, to this alignment.Link instance.
+ * See SemanticLabelDomainLevel enum class, for checking what type of labels are there currently.
+ *
+ * @param label
+ */
+ public void addGroupLabel(GroupLabelDomainLevel aDomainLabel) throws CASException
+ {
+ addOneStringInGroupLabelList(aDomainLabel.toString());
+ }
+
+ /**
+ * Use this method to add one semantic group label (inference level).
+ * To add multiple labels, call this method multiple times with different labels.
+ *
+ * Adding semantic group label is optional, but can be helpful for the grouping of the
+ * Links for the consumer of the JCas. Thus, it is highly recommended that an aligner
+ * should add minimally the inference level group label, if applicable.
-
\ No newline at end of file
+ * This method adds one inference level group label, to this alignment.Link instance.
+ * See SemanticLabelInferenceLevel enum class, for checking what type of labels are there currently.
+ *
+ * @param label
+ */
+ public void addGroupLabel(GroupLabelInferenceLevel aInferenceLabel) throws CASException
+ {
+ addOneStringInGroupLabelList(aInferenceLabel.toString());
+ }
+
+ /**
+ * Worker method for addGroupLabel.
+ *
+ * @param stringToAdd
+ * @throws CASException
+ */
+ private void addOneStringInGroupLabelList(String stringToAdd) throws CASException
+ {
+ NonEmptyStringList sList = (NonEmptyStringList) this.getGroupLabel();
+
+ // if the underlying StringList is null, make a new head. (underlying String list is a linked list)
+ if (sList == null)
+ {
+ NonEmptyStringList head = new NonEmptyStringList(this.getCAS().getJCas());
+ head.setHead(stringToAdd);
+ this.setGroupLabel(head);
+
+ }
+ else
+ {
+ // get to the last part, and add label as a string
+ NonEmptyStringList i = sList;
+
+ // find the last node ...
+ while(i.getTail() != null)
+ {
+ i = (NonEmptyStringList) i.getTail();
+ }
+
+ // add new node at the end.
+ NonEmptyStringList newNode = new NonEmptyStringList(this.getCAS().getJCas());
+ newNode.setHead(stringToAdd);
+ i.setTail(newNode);
+ }
+ }
+
+
+
+ }
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/alignment/LinkUtils.java b/common/src/main/java/eu/excitement/type/alignment/LinkUtils.java
new file mode 100644
index 00000000..e7d5b6bb
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/alignment/LinkUtils.java
@@ -0,0 +1,208 @@
+package eu.excitement.type.alignment;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.uima.cas.CASException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.TOP;
+import org.uimafit.util.JCasUtil;
+
+import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;
+
+/**
+ * Some utility methods for alignment.Link type and related codes.
+ *
+ * ** UNDER CONSTRUCTION **;
+ * ( feel free to add / request static utility methods that would be useful for alignment.Link instances in CAS)
+ *
+ * @author Tae-Gil Noh
+ * @since June, 2014
+ *
+ */
+public class LinkUtils {
+
+ /**
+ * This method checks the alignment.Link instances of the given JCas.
+ * If something is missing / not correct, it will throw an exception.
+ * Use this method within the development process of an AlignerComponent,
+ * (to check your aligner output is acceptable) or of an EDA.
+ *
+ * (Consider this as a minimal checker that will check the conventions
+ * on link instances that EOP developers have all agreed upon.)
+ *
+ * Note that the prober code will some detail about the content that it checks
+ * on log4j as DEBUG.
+ *
+ * Note that, no link makes no exception. (A possible output from an PairAnnotator).
+ * It only check the link instances.
+ *
+ * @param aJCas JCas with EOP views and Links.
+ */
+ public static void probeLinksInCAS(JCas aJCas) throws CASException
+ {
+ // TODO work on this once
+
+ }
+
+ /**
+ * This utility method fetches alignment.Link instances that links the give
+ * "Type" of annotations. More specifically, the method returns all link
+ * instances that connects Targets, which holds the give "type".
+ *
+ * For example, a call with type=Token.class will return all Link instances
+ * where either of its TSideTarget or HSideTarget holds "Token" annotation.
+ *
+ * The method will return all link instances, if one of its Targets hold
+ * the given the type.
+ *
+ * @param jCas the JCas with EOP views
+ * @param type target annotation class.
+ * @return a List that holds all links that satisfy the condition. If none satisfy the condition, it will return an empty List.
+ */
+ public static List selectLinksWith(JCas aJCas, Class type) throws CASException
+ {
+ List resultList = new ArrayList();
+
+ JCas hypoView = aJCas.getView("HypothesisView");
+ // get Links that satisfy the condition by iterating all Links just once.
+
+ for (Link l : JCasUtil.select(hypoView, Link.class))
+ {
+ // is this link holds type object in either of its target?
+ Target tt = l.getTSideTarget();
+ Target ht = l.getHSideTarget();
+
+ if (JCasUtil.select(tt.getTargetAnnotations(), type).size() > 0)
+ {
+ // T side target does hold at least one of type instance.
+ resultList.add(l);
+ continue; // no need to check h side target
+ }
+
+ if (JCasUtil.select(ht.getTargetAnnotations(), type).size() > 0)
+ {
+ // H side target does hold at least one of type instance.
+ resultList.add(l);
+ }
+ }
+ return resultList;
+ }
+
+
+ /**
+ * Use this utility method to fetch Links of specific aligner, or links of specific relations.
+ * The method will fetch only those links that satisfy your given condition (such as alignerID, versionID and linkInfo string)
+ * if you put null, it would ignore that part of the link ID (as don't care).
+ *
+ * For example, alignerID = "WordNetAligner", with versionID=null and linkInfo = null,
+ * will fetch all the links that has been added by "WordNetAligner", regardless of version and linkInfo.
+ *
+ * @param aJCas
+ * @param alignerID
+ * @param versionID
+ * @param linkInfo
+ * @return
+ * @throws CASException
+ */
+ public static List selectLinksWith(JCas aJCas, String alignerID, String versionID, String linkInfo) throws CASException
+ {
+ // get links with those names;
+ // "null" means "don't care".
+ List resultList = new ArrayList();
+
+ JCas hypoView = aJCas.getView("HypothesisView");
+ // get Links that satisfy the condition by iterating all Links just once.
+
+ for (Link l : JCasUtil.select(hypoView, Link.class))
+ {
+ // pass if the link does not satisfy the given IDs.
+ if (alignerID != null && (!l.getAlignerID().equals(alignerID)))
+ continue; // condition given and no match - skip this one
+
+ if (versionID != null && (!l.getAlignerVersion().equals(versionID)))
+ continue; // condition given and no match - skip this one.
+
+ if (linkInfo != null && (!l.getLinkInfo().equals(linkInfo)) )
+ continue; // condition given and no match - skip.
+
+ // Okay, all given conditions are met. push it.
+ resultList.add(l);
+ }
+ return resultList;
+ }
+
+ /**
+ * Use this utility method to fetch Links added by specific aligner.
+ * The method will fetch only those links that satisfy your given condition (alignerID)
+ * where the ID would be checked by alignment.Link.getAlignerID()
+ *
+ * @param aJCas
+ * @param alignerID that will be compared to link.getAlignerID()
+ * @return
+ * @throws CASException
+ */
+ public static List selectLinksWith(JCas aJCas, String alignerID) throws CASException
+ {
+ return selectLinksWith(aJCas, alignerID, null, null);
+ }
+
+// public static List selectLinksWith(String fullID)
+// {
+// // get links where link.getID() == fullID
+// // TODO work on this once
+// return null;
+// }
+
+ /**
+ * Utility class that is useful to see what surface level (token level) Links are added in the given CAS.
+ * This method iterates all Links that includes tokens within their targets, and shows them (only tokens!
+ * does not show other items in Target. ) --- Thus, the method is not generic enough to be used to check
+ * Link (and targets) that links more than tokens.
+ *
+ * @param aJCas
+ * @param os
+ */
+ public static void dumpTokenLevelLinks(JCas aJCas, PrintStream ps) throws CASException
+ {
+ // get all links that connects Tokens...
+
+ List tokenLevelLinks = selectLinksWith(aJCas, Token.class);
+
+ ps.println("The CAS has " + tokenLevelLinks.size() + " Link instances in it.");
+
+ int linkNum = 0;
+ for(Link l : tokenLevelLinks)
+ {
+ // output to the give output stream
+ ps.print("Link " + linkNum);
+ // The link information
+ ps.println(" (" + l.getDirectionString() + ", " + l.getID() + ", " + l.getStrength() + ")");
+ linkNum++;
+
+ Target tside = l.getTSideTarget();
+ Target hside = l.getHSideTarget();
+
+ // T side target has n tokens... TEXT(begin,end) TEXT(begin, end) ...
+ Collection tokens = JCasUtil.select(tside.getTargetAnnotations(), Token.class);
+ ps.print("\t TSide target has " + tokens.size() + " token(s): ");
+ for (Token t: tokens)
+ {
+ ps.print(t.getCoveredText() + "(" + t.getBegin() + "," + t.getEnd() + ") ");
+ }
+ ps.println("");
+
+ // H side target has m tokens ...
+ tokens = JCasUtil.select(hside.getTargetAnnotations(), Token.class);
+ ps.print("\t HSide target has " + tokens.size() + " token(s): ");
+ for (Token t: tokens)
+ {
+ ps.print(t.getCoveredText() + "(" + t.getBegin() + "," + t.getEnd() + ") ");
+ }
+ ps.println("");
+
+ }
+ }
+}
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruth.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruth.java
index cf3efd99..655904dc 100644
--- a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruth.java
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruth.java
@@ -7,12 +7,13 @@
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
+import org.apache.uima.jcas.cas.FSArray;
import org.apache.uima.jcas.tcas.Annotation;
-/** This type represents a clause truth value annotation.
- * Updated by JCasGen Fri Oct 05 20:17:26 CEST 2012
- * XML source: /Users/tailblues/progs/github/Excitement-Open-Platform/common/src/main/resources/desc/type/PredicateTruth.xml
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
* @generated */
public class ClauseTruth extends Annotation {
/** @generated
@@ -54,30 +55,61 @@ public ClauseTruth(JCas jcas, int begin, int end) {
readObject();
}
- /**
+ /**
+ *
* Write your own initialization here
*
- @generated modifiable */
+ *
+ * @generated modifiable
+ */
private void readObject() {/*default - does nothing empty block */}
//*--------------*
- //* Feature: value
+ //* Feature: clauseTokens
- /** getter for value - gets This represents the value of the annotation.
- * @generated */
- public String getValue() {
- if (ClauseTruth_Type.featOkTst && ((ClauseTruth_Type)jcasType).casFeat_value == null)
- jcasType.jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.ClauseTruth");
- return jcasType.ll_cas.ll_getStringValue(addr, ((ClauseTruth_Type)jcasType).casFeatCode_value);}
+ /** getter for clauseTokens - gets
+ * @generated
+ * @return value of the feature
+ */
+ public FSArray getClauseTokens() {
+ if (ClauseTruth_Type.featOkTst && ((ClauseTruth_Type)jcasType).casFeat_clauseTokens == null)
+ jcasType.jcas.throwFeatMissing("clauseTokens", "eu.excitement.type.predicatetruth.ClauseTruth");
+ return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((ClauseTruth_Type)jcasType).casFeatCode_clauseTokens)));}
- /** setter for value - sets This represents the value of the annotation.
- * @generated */
- public void setValue(String v) {
- if (ClauseTruth_Type.featOkTst && ((ClauseTruth_Type)jcasType).casFeat_value == null)
- jcasType.jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.ClauseTruth");
- jcasType.ll_cas.ll_setStringValue(addr, ((ClauseTruth_Type)jcasType).casFeatCode_value, v);}
+ /** setter for clauseTokens - sets
+ * @generated
+ * @param v value to set into the feature
+ */
+ public void setClauseTokens(FSArray v) {
+ if (ClauseTruth_Type.featOkTst && ((ClauseTruth_Type)jcasType).casFeat_clauseTokens == null)
+ jcasType.jcas.throwFeatMissing("clauseTokens", "eu.excitement.type.predicatetruth.ClauseTruth");
+ jcasType.ll_cas.ll_setRefValue(addr, ((ClauseTruth_Type)jcasType).casFeatCode_clauseTokens, jcasType.ll_cas.ll_getFSRef(v));}
+
+ /** indexed getter for clauseTokens - gets an indexed value - This is an array that can hold one or
+more tokens. Representing the tokens which comprise this clause.
+ * @generated
+ * @param i index in the array to get
+ * @return value of the element at index i
+ */
+ public Annotation getClauseTokens(int i) {
+ if (ClauseTruth_Type.featOkTst && ((ClauseTruth_Type)jcasType).casFeat_clauseTokens == null)
+ jcasType.jcas.throwFeatMissing("clauseTokens", "eu.excitement.type.predicatetruth.ClauseTruth");
+ jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ClauseTruth_Type)jcasType).casFeatCode_clauseTokens), i);
+ return (Annotation)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ClauseTruth_Type)jcasType).casFeatCode_clauseTokens), i)));}
+
+ /** indexed setter for clauseTokens - sets an indexed value - This is an array that can hold one or
+more tokens. Representing the tokens which comprise this clause.
+ * @generated
+ * @param i index in the array to set
+ * @param v value to set into the array
+ */
+ public void setClauseTokens(int i, Annotation v) {
+ if (ClauseTruth_Type.featOkTst && ((ClauseTruth_Type)jcasType).casFeat_clauseTokens == null)
+ jcasType.jcas.throwFeatMissing("clauseTokens", "eu.excitement.type.predicatetruth.ClauseTruth");
+ jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ClauseTruth_Type)jcasType).casFeatCode_clauseTokens), i);
+ jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ClauseTruth_Type)jcasType).casFeatCode_clauseTokens), i, jcasType.ll_cas.ll_getFSRef(v));}
}
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNegative.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNegative.java
new file mode 100644
index 00000000..edb61bc2
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNegative.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Mon Jul 14 22:26:14 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class ClauseTruthNegative extends ClauseTruth {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(ClauseTruthNegative.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected ClauseTruthNegative() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public ClauseTruthNegative(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public ClauseTruthNegative(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public ClauseTruthNegative(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNegative_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNegative_Type.java
new file mode 100644
index 00000000..c42a799c
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNegative_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Mon Jul 14 22:26:14 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class ClauseTruthNegative_Type extends ClauseTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (ClauseTruthNegative_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = ClauseTruthNegative_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new ClauseTruthNegative(addr, ClauseTruthNegative_Type.this);
+ ClauseTruthNegative_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new ClauseTruthNegative(addr, ClauseTruthNegative_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = ClauseTruthNegative.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.ClauseTruthNegative");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public ClauseTruthNegative_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNotIdentified.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNotIdentified.java
new file mode 100644
index 00000000..40728a0b
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNotIdentified.java
@@ -0,0 +1,77 @@
+
+
+/* First created by JCasGen Mon Jul 14 22:29:07 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class ClauseTruthNotIdentified extends ClauseTruth {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(ClauseTruthNotIdentified.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected ClauseTruthNotIdentified() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public ClauseTruthNotIdentified(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public ClauseTruthNotIdentified(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public ClauseTruthNotIdentified(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNotIdentified_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNotIdentified_Type.java
new file mode 100644
index 00000000..a77ca60a
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthNotIdentified_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Mon Jul 14 22:29:07 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class ClauseTruthNotIdentified_Type extends ClauseTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (ClauseTruthNotIdentified_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = ClauseTruthNotIdentified_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new ClauseTruthNotIdentified(addr, ClauseTruthNotIdentified_Type.this);
+ ClauseTruthNotIdentified_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new ClauseTruthNotIdentified(addr, ClauseTruthNotIdentified_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = ClauseTruthNotIdentified.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.ClauseTruthNotIdentified");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public ClauseTruthNotIdentified_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthPositive.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthPositive.java
new file mode 100644
index 00000000..6117eb03
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthPositive.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Mon Jul 14 20:04:02 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class ClauseTruthPositive extends ClauseTruth {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(ClauseTruthPositive.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected ClauseTruthPositive() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public ClauseTruthPositive(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public ClauseTruthPositive(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public ClauseTruthPositive(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthPositive_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthPositive_Type.java
new file mode 100644
index 00000000..b01a20fa
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthPositive_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Mon Jul 14 20:04:02 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class ClauseTruthPositive_Type extends ClauseTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (ClauseTruthPositive_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = ClauseTruthPositive_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new ClauseTruthPositive(addr, ClauseTruthPositive_Type.this);
+ ClauseTruthPositive_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new ClauseTruthPositive(addr, ClauseTruthPositive_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = ClauseTruthPositive.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.ClauseTruthPositive");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public ClauseTruthPositive_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUncertain.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUncertain.java
new file mode 100644
index 00000000..e018b1d9
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUncertain.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Mon Jul 14 22:26:14 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class ClauseTruthUncertain extends ClauseTruth {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(ClauseTruthUncertain.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected ClauseTruthUncertain() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public ClauseTruthUncertain(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public ClauseTruthUncertain(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public ClauseTruthUncertain(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUncertain_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUncertain_Type.java
new file mode 100644
index 00000000..c9be7bfb
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUncertain_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Mon Jul 14 22:26:14 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class ClauseTruthUncertain_Type extends ClauseTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (ClauseTruthUncertain_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = ClauseTruthUncertain_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new ClauseTruthUncertain(addr, ClauseTruthUncertain_Type.this);
+ ClauseTruthUncertain_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new ClauseTruthUncertain(addr, ClauseTruthUncertain_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = ClauseTruthUncertain.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.ClauseTruthUncertain");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public ClauseTruthUncertain_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUnknown.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUnknown.java
new file mode 100644
index 00000000..9a56b5b7
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUnknown.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Mon Jul 14 22:27:25 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Mon Jul 14 22:27:25 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/ClauseTruth.xml
+ * @generated */
+public class ClauseTruthUnknown extends ClauseTruth {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(ClauseTruthUnknown.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected ClauseTruthUnknown() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public ClauseTruthUnknown(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public ClauseTruthUnknown(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public ClauseTruthUnknown(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUnknown_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUnknown_Type.java
new file mode 100644
index 00000000..8e02364a
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruthUnknown_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Mon Jul 14 22:27:25 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Mon Jul 14 22:27:25 IDT 2014
+ * @generated */
+public class ClauseTruthUnknown_Type extends ClauseTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (ClauseTruthUnknown_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = ClauseTruthUnknown_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new ClauseTruthUnknown(addr, ClauseTruthUnknown_Type.this);
+ ClauseTruthUnknown_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new ClauseTruthUnknown(addr, ClauseTruthUnknown_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = ClauseTruthUnknown.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.ClauseTruthUnknown");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public ClauseTruthUnknown_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruth_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruth_Type.java
index 26c17a5d..8a787a24 100644
--- a/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruth_Type.java
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/ClauseTruth_Type.java
@@ -13,8 +13,8 @@
import org.apache.uima.cas.Feature;
import org.apache.uima.jcas.tcas.Annotation_Type;
-/** This type represents a clause truth value annotation.
- * Updated by JCasGen Fri Oct 05 20:17:26 CEST 2012
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
* @generated */
public class ClauseTruth_Type extends Annotation_Type {
/** @generated */
@@ -45,22 +45,55 @@ public FeatureStructure createFS(int addr, CASImpl cas) {
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.ClauseTruth");
/** @generated */
- final Feature casFeat_value;
+ final Feature casFeat_clauseTokens;
/** @generated */
- final int casFeatCode_value;
- /** @generated */
- public String getValue(int addr) {
- if (featOkTst && casFeat_value == null)
- jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.ClauseTruth");
- return ll_cas.ll_getStringValue(addr, casFeatCode_value);
+ final int casFeatCode_clauseTokens;
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @return the feature value
+ */
+ public int getClauseTokens(int addr) {
+ if (featOkTst && casFeat_clauseTokens == null)
+ jcas.throwFeatMissing("clauseTokens", "eu.excitement.type.predicatetruth.ClauseTruth");
+ return ll_cas.ll_getRefValue(addr, casFeatCode_clauseTokens);
}
- /** @generated */
- public void setValue(int addr, String v) {
- if (featOkTst && casFeat_value == null)
- jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.ClauseTruth");
- ll_cas.ll_setStringValue(addr, casFeatCode_value, v);}
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param v value to set
+ */
+ public void setClauseTokens(int addr, int v) {
+ if (featOkTst && casFeat_clauseTokens == null)
+ jcas.throwFeatMissing("clauseTokens", "eu.excitement.type.predicatetruth.ClauseTruth");
+ ll_cas.ll_setRefValue(addr, casFeatCode_clauseTokens, v);}
-
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param i index of item in the array
+ * @return value at index i in the array
+ */
+ public int getClauseTokens(int addr, int i) {
+ if (featOkTst && casFeat_clauseTokens == null)
+ jcas.throwFeatMissing("clauseTokens", "eu.excitement.type.predicatetruth.ClauseTruth");
+ if (lowLevelTypeChecks)
+ return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_clauseTokens), i, true);
+ jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_clauseTokens), i);
+ return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_clauseTokens), i);
+ }
+
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param i index of item in the array
+ * @param v value to set
+ */
+ public void setClauseTokens(int addr, int i, int v) {
+ if (featOkTst && casFeat_clauseTokens == null)
+ jcas.throwFeatMissing("clauseTokens", "eu.excitement.type.predicatetruth.ClauseTruth");
+ if (lowLevelTypeChecks)
+ ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_clauseTokens), i, v, true);
+ jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_clauseTokens), i);
+ ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_clauseTokens), i, v);
+ }
+
@@ -71,8 +104,8 @@ public ClauseTruth_Type(JCas jcas, Type casType) {
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
- casFeat_value = jcas.getRequiredFeatureDE(casType, "value", "eu.excitement.type.predicatetruth.ClauseTruthValue", featOkTst);
- casFeatCode_value = (null == casFeat_value) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_value).getCode();
+ casFeat_clauseTokens = jcas.getRequiredFeatureDE(casType, "clauseTokens", "uima.cas.FSArray", featOkTst);
+ casFeatCode_clauseTokens = (null == casFeat_clauseTokens) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_clauseTokens).getCode();
}
}
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertainty.java b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertainty.java
index d62e99ea..48a1845e 100644
--- a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertainty.java
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertainty.java
@@ -10,9 +10,9 @@
import org.apache.uima.jcas.tcas.Annotation;
-/** This type represents a negation-and-uncertainty annotation.
- * Updated by JCasGen Fri Oct 05 20:17:26 CEST 2012
- * XML source: /Users/tailblues/progs/github/Excitement-Open-Platform/common/src/main/resources/desc/type/PredicateTruth.xml
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
* @generated */
public class NegationAndUncertainty extends Annotation {
/** @generated
@@ -54,30 +54,17 @@ public NegationAndUncertainty(JCas jcas, int begin, int end) {
readObject();
}
- /**
+ /**
+ *
* Write your own initialization here
*
- @generated modifiable */
+ *
+ * @generated modifiable
+ */
private void readObject() {/*default - does nothing empty block */}
- //*--------------*
- //* Feature: value
-
- /** getter for value - gets This represents the value of the annotation.
- * @generated */
- public String getValue() {
- if (NegationAndUncertainty_Type.featOkTst && ((NegationAndUncertainty_Type)jcasType).casFeat_value == null)
- jcasType.jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.NegationAndUncertainty");
- return jcasType.ll_cas.ll_getStringValue(addr, ((NegationAndUncertainty_Type)jcasType).casFeatCode_value);}
-
- /** setter for value - sets This represents the value of the annotation.
- * @generated */
- public void setValue(String v) {
- if (NegationAndUncertainty_Type.featOkTst && ((NegationAndUncertainty_Type)jcasType).casFeat_value == null)
- jcasType.jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.NegationAndUncertainty");
- jcasType.ll_cas.ll_setStringValue(addr, ((NegationAndUncertainty_Type)jcasType).casFeatCode_value, v);}
- }
+}
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyNegative.java b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyNegative.java
new file mode 100644
index 00000000..a72364b1
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyNegative.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class NegationAndUncertaintyNegative extends NegationAndUncertainty {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(NegationAndUncertaintyNegative.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected NegationAndUncertaintyNegative() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public NegationAndUncertaintyNegative(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public NegationAndUncertaintyNegative(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public NegationAndUncertaintyNegative(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyNegative_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyNegative_Type.java
new file mode 100644
index 00000000..1c745a34
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyNegative_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class NegationAndUncertaintyNegative_Type extends NegationAndUncertainty_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (NegationAndUncertaintyNegative_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = NegationAndUncertaintyNegative_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new NegationAndUncertaintyNegative(addr, NegationAndUncertaintyNegative_Type.this);
+ NegationAndUncertaintyNegative_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new NegationAndUncertaintyNegative(addr, NegationAndUncertaintyNegative_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = NegationAndUncertaintyNegative.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.NegationAndUncertaintyNegative");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public NegationAndUncertaintyNegative_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyPositive.java b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyPositive.java
new file mode 100644
index 00000000..4886c09a
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyPositive.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class NegationAndUncertaintyPositive extends NegationAndUncertainty {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(NegationAndUncertaintyPositive.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected NegationAndUncertaintyPositive() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public NegationAndUncertaintyPositive(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public NegationAndUncertaintyPositive(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public NegationAndUncertaintyPositive(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyPositive_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyPositive_Type.java
new file mode 100644
index 00000000..a82fa667
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyPositive_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class NegationAndUncertaintyPositive_Type extends NegationAndUncertainty_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (NegationAndUncertaintyPositive_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = NegationAndUncertaintyPositive_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new NegationAndUncertaintyPositive(addr, NegationAndUncertaintyPositive_Type.this);
+ NegationAndUncertaintyPositive_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new NegationAndUncertaintyPositive(addr, NegationAndUncertaintyPositive_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = NegationAndUncertaintyPositive.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.NegationAndUncertaintyPositive");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public NegationAndUncertaintyPositive_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyUncertain.java b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyUncertain.java
new file mode 100644
index 00000000..4d5799d4
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyUncertain.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class NegationAndUncertaintyUncertain extends NegationAndUncertainty {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(NegationAndUncertaintyUncertain.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected NegationAndUncertaintyUncertain() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public NegationAndUncertaintyUncertain(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public NegationAndUncertaintyUncertain(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public NegationAndUncertaintyUncertain(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyUncertain_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyUncertain_Type.java
new file mode 100644
index 00000000..f1ed6f5e
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertaintyUncertain_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class NegationAndUncertaintyUncertain_Type extends NegationAndUncertainty_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (NegationAndUncertaintyUncertain_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = NegationAndUncertaintyUncertain_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new NegationAndUncertaintyUncertain(addr, NegationAndUncertaintyUncertain_Type.this);
+ NegationAndUncertaintyUncertain_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new NegationAndUncertaintyUncertain(addr, NegationAndUncertaintyUncertain_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = NegationAndUncertaintyUncertain.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.NegationAndUncertaintyUncertain");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public NegationAndUncertaintyUncertain_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertainty_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertainty_Type.java
index 7feda93c..e3486b1b 100644
--- a/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertainty_Type.java
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/NegationAndUncertainty_Type.java
@@ -2,19 +2,17 @@
/* First created by JCasGen Fri Oct 05 20:17:26 CEST 2012 */
package eu.excitement.type.predicatetruth;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
-import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.impl.TypeImpl;
-import org.apache.uima.cas.Type;
-import org.apache.uima.cas.impl.FeatureImpl;
-import org.apache.uima.cas.Feature;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.tcas.Annotation_Type;
-/** This type represents a negation-and-uncertainty annotation.
- * Updated by JCasGen Fri Oct 05 20:17:26 CEST 2012
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
* @generated */
public class NegationAndUncertainty_Type extends Annotation_Type {
/** @generated */
@@ -44,36 +42,12 @@ public FeatureStructure createFS(int addr, CASImpl cas) {
//@SuppressWarnings ("hiding")
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.NegationAndUncertainty");
- /** @generated */
- final Feature casFeat_value;
- /** @generated */
- final int casFeatCode_value;
- /** @generated */
- public String getValue(int addr) {
- if (featOkTst && casFeat_value == null)
- jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.NegationAndUncertainty");
- return ll_cas.ll_getStringValue(addr, casFeatCode_value);
- }
- /** @generated */
- public void setValue(int addr, String v) {
- if (featOkTst && casFeat_value == null)
- jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.NegationAndUncertainty");
- ll_cas.ll_setStringValue(addr, casFeatCode_value, v);}
-
-
-
-
-
/** initialize variables to correspond with Cas Type and Features
* @generated */
public NegationAndUncertainty_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
-
- casFeat_value = jcas.getRequiredFeatureDE(casType, "value", "eu.excitement.type.predicatetruth.NegationAndUncertaintyValue", featOkTst);
- casFeatCode_value = (null == casFeat_value) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_value).getCode();
-
}
}
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignature.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignature.java
index 5f5ca449..7a332e34 100644
--- a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignature.java
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignature.java
@@ -10,9 +10,9 @@
import org.apache.uima.jcas.tcas.Annotation;
-/** This type represents an implication signature of a predicate.
- * Updated by JCasGen Fri Oct 05 20:17:26 CEST 2012
- * XML source: /Users/tailblues/progs/github/Excitement-Open-Platform/common/src/main/resources/desc/type/PredicateTruth.xml
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
* @generated */
public class PredicateSignature extends Annotation {
/** @generated
@@ -54,10 +54,13 @@ public PredicateSignature(JCas jcas, int begin, int end) {
readObject();
}
- /**
+ /**
+ *
* Write your own initialization here
*
- @generated modifiable */
+ *
+ * @generated modifiable
+ */
private void readObject() {/*default - does nothing empty block */}
}
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeNegative.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeNegative.java
new file mode 100644
index 00000000..3cc9d301
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeNegative.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignatureNegativeNegative extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignatureNegativeNegative.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignatureNegativeNegative() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignatureNegativeNegative(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignatureNegativeNegative(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignatureNegativeNegative(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeNegative_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeNegative_Type.java
new file mode 100644
index 00000000..c665ac7e
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeNegative_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignatureNegativeNegative_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignatureNegativeNegative_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignatureNegativeNegative_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignatureNegativeNegative(addr, PredicateSignatureNegativeNegative_Type.this);
+ PredicateSignatureNegativeNegative_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignatureNegativeNegative(addr, PredicateSignatureNegativeNegative_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignatureNegativeNegative.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignatureNegativeNegative");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignatureNegativeNegative_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativePositive.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativePositive.java
new file mode 100644
index 00000000..a926ff54
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativePositive.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignatureNegativePositive extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignatureNegativePositive.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignatureNegativePositive() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignatureNegativePositive(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignatureNegativePositive(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignatureNegativePositive(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativePositive_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativePositive_Type.java
new file mode 100644
index 00000000..4077c3ec
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativePositive_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignatureNegativePositive_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignatureNegativePositive_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignatureNegativePositive_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignatureNegativePositive(addr, PredicateSignatureNegativePositive_Type.this);
+ PredicateSignatureNegativePositive_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignatureNegativePositive(addr, PredicateSignatureNegativePositive_Type.this);
+ }
+ };
+ /** @generated */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignatureNegativePositive.typeIndexID;
+ /** @generated
+ @modifiable */
+ // @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignatureNegativePositive");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignatureNegativePositive_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeUncertain.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeUncertain.java
new file mode 100644
index 00000000..f1caae9b
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeUncertain.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignatureNegativeUncertain extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignatureNegativeUncertain.class);
+ /** @generated
+ * @ordered
+ */
+ // @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignatureNegativeUncertain() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignatureNegativeUncertain(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignatureNegativeUncertain(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignatureNegativeUncertain(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeUncertain_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeUncertain_Type.java
new file mode 100644
index 00000000..e0697631
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureNegativeUncertain_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignatureNegativeUncertain_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignatureNegativeUncertain_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignatureNegativeUncertain_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignatureNegativeUncertain(addr, PredicateSignatureNegativeUncertain_Type.this);
+ PredicateSignatureNegativeUncertain_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignatureNegativeUncertain(addr, PredicateSignatureNegativeUncertain_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignatureNegativeUncertain.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignatureNegativeUncertain");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignatureNegativeUncertain_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveNegative.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveNegative.java
new file mode 100644
index 00000000..a96c2ada
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveNegative.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignaturePositiveNegative extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignaturePositiveNegative.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignaturePositiveNegative() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignaturePositiveNegative(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignaturePositiveNegative(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignaturePositiveNegative(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveNegative_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveNegative_Type.java
new file mode 100644
index 00000000..2e6bb5c3
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveNegative_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignaturePositiveNegative_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignaturePositiveNegative_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignaturePositiveNegative_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignaturePositiveNegative(addr, PredicateSignaturePositiveNegative_Type.this);
+ PredicateSignaturePositiveNegative_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignaturePositiveNegative(addr, PredicateSignaturePositiveNegative_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignaturePositiveNegative.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignaturePositiveNegative");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignaturePositiveNegative_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositivePositive.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositivePositive.java
new file mode 100644
index 00000000..4295b6f0
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositivePositive.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignaturePositivePositive extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignaturePositivePositive.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignaturePositivePositive() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignaturePositivePositive(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignaturePositivePositive(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignaturePositivePositive(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositivePositive_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositivePositive_Type.java
new file mode 100644
index 00000000..fef06043
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositivePositive_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignaturePositivePositive_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignaturePositivePositive_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignaturePositivePositive_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignaturePositivePositive(addr, PredicateSignaturePositivePositive_Type.this);
+ PredicateSignaturePositivePositive_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignaturePositivePositive(addr, PredicateSignaturePositivePositive_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignaturePositivePositive.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignaturePositivePositive");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignaturePositivePositive_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveUncertain.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveUncertain.java
new file mode 100644
index 00000000..2b825649
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveUncertain.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignaturePositiveUncertain extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignaturePositiveUncertain.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignaturePositiveUncertain() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignaturePositiveUncertain(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignaturePositiveUncertain(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignaturePositiveUncertain(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveUncertain_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveUncertain_Type.java
new file mode 100644
index 00000000..be90deb1
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignaturePositiveUncertain_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignaturePositiveUncertain_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignaturePositiveUncertain_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignaturePositiveUncertain_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignaturePositiveUncertain(addr, PredicateSignaturePositiveUncertain_Type.this);
+ PredicateSignaturePositiveUncertain_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignaturePositiveUncertain(addr, PredicateSignaturePositiveUncertain_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignaturePositiveUncertain.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignaturePositiveUncertain");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignaturePositiveUncertain_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainNegative.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainNegative.java
new file mode 100644
index 00000000..045ce06f
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainNegative.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignatureUncertainNegative extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignatureUncertainNegative.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignatureUncertainNegative() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignatureUncertainNegative(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignatureUncertainNegative(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignatureUncertainNegative(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainNegative_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainNegative_Type.java
new file mode 100644
index 00000000..30cc702c
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainNegative_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignatureUncertainNegative_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignatureUncertainNegative_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignatureUncertainNegative_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignatureUncertainNegative(addr, PredicateSignatureUncertainNegative_Type.this);
+ PredicateSignatureUncertainNegative_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignatureUncertainNegative(addr, PredicateSignatureUncertainNegative_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignatureUncertainNegative.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignatureUncertainNegative");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignatureUncertainNegative_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainPositive.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainPositive.java
new file mode 100644
index 00000000..8aba604f
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainPositive.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignatureUncertainPositive extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignatureUncertainPositive.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignatureUncertainPositive() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignatureUncertainPositive(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignatureUncertainPositive(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignatureUncertainPositive(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainPositive_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainPositive_Type.java
new file mode 100644
index 00000000..a03c06e1
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainPositive_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignatureUncertainPositive_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignatureUncertainPositive_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignatureUncertainPositive_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignatureUncertainPositive(addr, PredicateSignatureUncertainPositive_Type.this);
+ PredicateSignatureUncertainPositive_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignatureUncertainPositive(addr, PredicateSignatureUncertainPositive_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignatureUncertainPositive.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignatureUncertainPositive");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignatureUncertainPositive_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainUncertain.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainUncertain.java
new file mode 100644
index 00000000..8c2b8249
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainUncertain.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateSignatureUncertainUncertain extends PredicateSignature {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateSignatureUncertainUncertain.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateSignatureUncertainUncertain() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateSignatureUncertainUncertain(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateSignatureUncertainUncertain(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateSignatureUncertainUncertain(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainUncertain_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainUncertain_Type.java
new file mode 100644
index 00000000..efcbadb4
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignatureUncertainUncertain_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Tue Jul 15 10:01:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateSignatureUncertainUncertain_Type extends PredicateSignature_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateSignatureUncertainUncertain_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateSignatureUncertainUncertain_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateSignatureUncertainUncertain(addr, PredicateSignatureUncertainUncertain_Type.this);
+ PredicateSignatureUncertainUncertain_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateSignatureUncertainUncertain(addr, PredicateSignatureUncertainUncertain_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateSignatureUncertainUncertain.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateSignatureUncertainUncertain");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateSignatureUncertainUncertain_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignature_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignature_Type.java
index 5e9d43fc..8175a0fd 100644
--- a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignature_Type.java
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateSignature_Type.java
@@ -11,8 +11,8 @@
import org.apache.uima.cas.Type;
import org.apache.uima.jcas.tcas.Annotation_Type;
-/** This type represents an implication signature of a predicate.
- * Updated by JCasGen Fri Oct 05 20:17:26 CEST 2012
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
* @generated */
public class PredicateSignature_Type extends Annotation_Type {
/** @generated */
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruth.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruth.java
index b75cbb66..d7da4534 100644
--- a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruth.java
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruth.java
@@ -10,9 +10,11 @@
import org.apache.uima.jcas.tcas.Annotation;
-/** This type represents a predicate truth value annotation.
- * Updated by JCasGen Fri Oct 05 20:17:26 CEST 2012
- * XML source: /Users/tailblues/progs/github/Excitement-Open-Platform/common/src/main/resources/desc/type/PredicateTruth.xml
+/** This type represents a predicate truth value annotation.
+It is an abstract representation from which the different Predicate Truth annotations will inherit (PT+,PT-,PT?).
+This annotation covers a single predicate token.
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
* @generated */
public class PredicateTruth extends Annotation {
/** @generated
@@ -54,30 +56,17 @@ public PredicateTruth(JCas jcas, int begin, int end) {
readObject();
}
- /**
+ /**
+ *
* Write your own initialization here
*
- @generated modifiable */
+ *
+ * @generated modifiable
+ */
private void readObject() {/*default - does nothing empty block */}
- //*--------------*
- //* Feature: value
-
- /** getter for value - gets This represents the value of the annotation.
- * @generated */
- public String getValue() {
- if (PredicateTruth_Type.featOkTst && ((PredicateTruth_Type)jcasType).casFeat_value == null)
- jcasType.jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.PredicateTruth");
- return jcasType.ll_cas.ll_getStringValue(addr, ((PredicateTruth_Type)jcasType).casFeatCode_value);}
-
- /** setter for value - sets This represents the value of the annotation.
- * @generated */
- public void setValue(String v) {
- if (PredicateTruth_Type.featOkTst && ((PredicateTruth_Type)jcasType).casFeat_value == null)
- jcasType.jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.PredicateTruth");
- jcasType.ll_cas.ll_setStringValue(addr, ((PredicateTruth_Type)jcasType).casFeatCode_value, v);}
- }
+}
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNegative.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNegative.java
new file mode 100644
index 00000000..18105e13
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNegative.java
@@ -0,0 +1,77 @@
+
+
+/* First created by JCasGen Sun Jul 13 18:54:20 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+/** This type annotates predicates with PT-.
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateTruthNegative extends PredicateTruth {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateTruthNegative.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateTruthNegative() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateTruthNegative(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateTruthNegative(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateTruthNegative(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNegative_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNegative_Type.java
new file mode 100644
index 00000000..c14b8dd5
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNegative_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Sun Jul 13 18:54:20 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+
+/** This type annotates predicates with PT-.
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateTruthNegative_Type extends PredicateTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateTruthNegative_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateTruthNegative_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateTruthNegative(addr, PredicateTruthNegative_Type.this);
+ PredicateTruthNegative_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateTruthNegative(addr, PredicateTruthNegative_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateTruthNegative.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateTruthNegative");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateTruthNegative_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNotIdentified.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNotIdentified.java
new file mode 100644
index 00000000..c24a26a2
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNotIdentified.java
@@ -0,0 +1,78 @@
+
+
+/* First created by JCasGen Mon Jul 14 14:59:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateTruthNotIdentified extends PredicateTruth {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateTruthNotIdentified.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateTruthNotIdentified() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateTruthNotIdentified(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateTruthNotIdentified(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateTruthNotIdentified(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNotIdentified_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNotIdentified_Type.java
new file mode 100644
index 00000000..b9bb68d5
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthNotIdentified_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Mon Jul 14 14:59:13 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+
+/**
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateTruthNotIdentified_Type extends PredicateTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateTruthNotIdentified_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateTruthNotIdentified_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateTruthNotIdentified(addr, PredicateTruthNotIdentified_Type.this);
+ PredicateTruthNotIdentified_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateTruthNotIdentified(addr, PredicateTruthNotIdentified_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateTruthNotIdentified.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateTruthNotIdentified");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateTruthNotIdentified_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthPositive.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthPositive.java
new file mode 100644
index 00000000..f9eeeba2
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthPositive.java
@@ -0,0 +1,77 @@
+
+
+/* First created by JCasGen Sun Jul 13 18:54:20 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+/** This type annotates predicates with PT+.
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateTruthPositive extends PredicateTruth {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateTruthPositive.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateTruthPositive() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateTruthPositive(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateTruthPositive(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateTruthPositive(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthPositive_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthPositive_Type.java
new file mode 100644
index 00000000..fc683228
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthPositive_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Sun Jul 13 18:54:20 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+
+/** This type annotates predicates with PT+.
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateTruthPositive_Type extends PredicateTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateTruthPositive_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateTruthPositive_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateTruthPositive(addr, PredicateTruthPositive_Type.this);
+ PredicateTruthPositive_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateTruthPositive(addr, PredicateTruthPositive_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateTruthPositive.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateTruthPositive");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateTruthPositive_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthUncertain.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthUncertain.java
new file mode 100644
index 00000000..a106d0c2
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthUncertain.java
@@ -0,0 +1,77 @@
+
+
+/* First created by JCasGen Sun Jul 13 18:54:20 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+
+/** This type annotates predicates with PT?.
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * XML source: C:/Users/user/fromHP/Shared/excitement workspace/eop/common/src/main/resources/desc/type/PredicateTruth.xml
+ * @generated */
+public class PredicateTruthUncertain extends PredicateTruth {
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(PredicateTruthUncertain.class);
+ /** @generated
+ * @ordered
+ */
+ //@SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected PredicateTruthUncertain() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public PredicateTruthUncertain(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public PredicateTruthUncertain(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public PredicateTruthUncertain(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ *
+ * Write your own initialization here
+ *
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+}
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthUncertain_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthUncertain_Type.java
new file mode 100644
index 00000000..064b2d09
--- /dev/null
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruthUncertain_Type.java
@@ -0,0 +1,62 @@
+
+/* First created by JCasGen Sun Jul 13 18:54:20 IDT 2014 */
+package eu.excitement.type.predicatetruth;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+
+/** This type annotates predicates with PT?.
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
+ * @generated */
+public class PredicateTruthUncertain_Type extends PredicateTruth_Type {
+ /** @generated
+ * @return the generator for this type
+ */
+ @Override
+ protected FSGenerator getFSGenerator() {return fsGenerator;}
+ /** @generated */
+ private final FSGenerator fsGenerator =
+ new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (PredicateTruthUncertain_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = PredicateTruthUncertain_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new PredicateTruthUncertain(addr, PredicateTruthUncertain_Type.this);
+ PredicateTruthUncertain_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else return new PredicateTruthUncertain(addr, PredicateTruthUncertain_Type.this);
+ }
+ };
+ /** @generated */
+ //@SuppressWarnings ("hiding")
+ public final static int typeIndexID = PredicateTruthUncertain.typeIndexID;
+ /** @generated
+ @modifiable */
+ //@SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateTruthUncertain");
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public PredicateTruthUncertain_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruth_Type.java b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruth_Type.java
index 39928ead..1908255c 100644
--- a/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruth_Type.java
+++ b/common/src/main/java/eu/excitement/type/predicatetruth/PredicateTruth_Type.java
@@ -2,19 +2,19 @@
/* First created by JCasGen Fri Oct 05 20:17:26 CEST 2012 */
package eu.excitement.type.predicatetruth;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
-import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.impl.TypeImpl;
-import org.apache.uima.cas.Type;
-import org.apache.uima.cas.impl.FeatureImpl;
-import org.apache.uima.cas.Feature;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.tcas.Annotation_Type;
-/** This type represents a predicate truth value annotation.
- * Updated by JCasGen Fri Oct 05 20:17:26 CEST 2012
+/** This type represents a predicate truth value annotation.
+It is an abstract representation from which the different Predicate Truth annotations will inherit (PT+,PT-,PT?).
+This annotation covers a single predicate token.
+ * Updated by JCasGen Tue Jul 15 10:01:13 IDT 2014
* @generated */
public class PredicateTruth_Type extends Annotation_Type {
/** @generated */
@@ -44,36 +44,12 @@ public FeatureStructure createFS(int addr, CASImpl cas) {
//@SuppressWarnings ("hiding")
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("eu.excitement.type.predicatetruth.PredicateTruth");
- /** @generated */
- final Feature casFeat_value;
- /** @generated */
- final int casFeatCode_value;
- /** @generated */
- public String getValue(int addr) {
- if (featOkTst && casFeat_value == null)
- jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.PredicateTruth");
- return ll_cas.ll_getStringValue(addr, casFeatCode_value);
- }
- /** @generated */
- public void setValue(int addr, String v) {
- if (featOkTst && casFeat_value == null)
- jcas.throwFeatMissing("value", "eu.excitement.type.predicatetruth.PredicateTruth");
- ll_cas.ll_setStringValue(addr, casFeatCode_value, v);}
-
-
-
-
-
/** initialize variables to correspond with Cas Type and Features
* @generated */
public PredicateTruth_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
-
- casFeat_value = jcas.getRequiredFeatureDE(casType, "value", "eu.excitement.type.predicatetruth.PredicateTruthValue", featOkTst);
- casFeatCode_value = (null == casFeat_value) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_value).getCode();
-
}
}
diff --git a/common/src/main/java/eu/excitementproject/eop/common/component/alignment/AlignmentComponentException.java b/common/src/main/java/eu/excitementproject/eop/common/component/alignment/AlignmentComponentException.java
new file mode 100644
index 00000000..414ce458
--- /dev/null
+++ b/common/src/main/java/eu/excitementproject/eop/common/component/alignment/AlignmentComponentException.java
@@ -0,0 +1,38 @@
+/**
+ *
+ */
+package eu.excitementproject.eop.common.component.alignment;
+
+/**
+ * The exception type for AlignmentComponents
+ *
+ * @author Tae-Gil Noh
+ *
+ */
+public class AlignmentComponentException extends PairAnnotatorComponentException {
+
+ private static final long serialVersionUID = 2157830765388558808L;
+
+ /**
+ * @param message
+ */
+ public AlignmentComponentException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public AlignmentComponentException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public AlignmentComponentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/common/src/main/java/eu/excitementproject/eop/common/component/alignment/PairAnnotatorComponent.java b/common/src/main/java/eu/excitementproject/eop/common/component/alignment/PairAnnotatorComponent.java
index 04fdf256..2d17432d 100644
--- a/common/src/main/java/eu/excitementproject/eop/common/component/alignment/PairAnnotatorComponent.java
+++ b/common/src/main/java/eu/excitementproject/eop/common/component/alignment/PairAnnotatorComponent.java
@@ -52,6 +52,6 @@ public interface PairAnnotatorComponent extends Component {
* was successful --- even though there were no added annotations
* (e.g. contradiction annotator, but there was no contradiction).
*/
- public void annotate(JCas aJCas);
+ public void annotate(JCas aJCas) throws PairAnnotatorComponentException;
}
diff --git a/common/src/main/java/eu/excitementproject/eop/common/component/alignment/PairAnnotatorComponentException.java b/common/src/main/java/eu/excitementproject/eop/common/component/alignment/PairAnnotatorComponentException.java
new file mode 100644
index 00000000..ec221d92
--- /dev/null
+++ b/common/src/main/java/eu/excitementproject/eop/common/component/alignment/PairAnnotatorComponentException.java
@@ -0,0 +1,39 @@
+package eu.excitementproject.eop.common.component.alignment;
+
+import eu.excitementproject.eop.common.exception.ComponentException;
+
+
+/**
+ * This is the exception prepared for PairAnnotatorComponent.
+ * @author Tae-Gil Noh
+ */
+public class PairAnnotatorComponentException extends ComponentException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1068712599109788009L;
+
+ /**
+ * @param message
+ */
+ public PairAnnotatorComponentException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public PairAnnotatorComponentException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public PairAnnotatorComponentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/common/src/main/java/eu/excitementproject/eop/common/datastructures/immutable/ImmutableList.java b/common/src/main/java/eu/excitementproject/eop/common/datastructures/immutable/ImmutableList.java
index 90ce1fe0..f07c08cf 100644
--- a/common/src/main/java/eu/excitementproject/eop/common/datastructures/immutable/ImmutableList.java
+++ b/common/src/main/java/eu/excitementproject/eop/common/datastructures/immutable/ImmutableList.java
@@ -30,4 +30,6 @@ public interface ImmutableList extends ImmutableCollection, Serializable
public String toString();
+ public String mutableListToString();
+
}
diff --git a/common/src/main/java/eu/excitementproject/eop/common/datastructures/immutable/ImmutableListWrapper.java b/common/src/main/java/eu/excitementproject/eop/common/datastructures/immutable/ImmutableListWrapper.java
index d282c205..43693621 100644
--- a/common/src/main/java/eu/excitementproject/eop/common/datastructures/immutable/ImmutableListWrapper.java
+++ b/common/src/main/java/eu/excitementproject/eop/common/datastructures/immutable/ImmutableListWrapper.java
@@ -126,6 +126,9 @@ public String toString()
return this.getClass().getSimpleName()+" wrapping "+realList.getClass().getSimpleName()+": "+realList.toString();
}
+ public String mutableListToString() {
+ return realList.toString();
+ }
@Override
public int hashCode()
diff --git a/common/src/main/java/eu/excitementproject/eop/common/representation/parse/tree/dependency/view/NodeShortString.java b/common/src/main/java/eu/excitementproject/eop/common/representation/parse/tree/dependency/view/NodeShortString.java
new file mode 100644
index 00000000..ec628a6e
--- /dev/null
+++ b/common/src/main/java/eu/excitementproject/eop/common/representation/parse/tree/dependency/view/NodeShortString.java
@@ -0,0 +1,86 @@
+package eu.excitementproject.eop.common.representation.parse.tree.dependency.view;
+
+import eu.excitementproject.eop.common.representation.parse.representation.basic.Info;
+import eu.excitementproject.eop.common.representation.parse.representation.basic.InfoGetFields;
+import eu.excitementproject.eop.common.representation.parse.tree.AbstractNode;
+
+public abstract class NodeShortString {
+ private static final String ROOT_STR = "";
+ public abstract String toString(AbstractNode extends I, ?> node);
+
+ public static String prepConcrete(AbstractNode extends I, ?> node) {
+ if (node.getInfo().getEdgeInfo().getDependencyRelation() != null &&
+ node.getInfo().getEdgeInfo().getDependencyRelation().getStringRepresentation().equals("prep")) {
+ return "_" + node.getInfo().getNodeInfo().getWordLemma();
+ }
+ else {
+ return "";
+ }
+ }
+
+
+ //// Concrete Classes ////////////////////////////////////////
+
+ public static class Rel extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR);
+ }
+ }
+
+ public static class RelPrep extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR)+prepConcrete(node);
+ }
+ }
+
+ public static class RelPos extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR)+"->"+InfoGetFields.getPartOfSpeech(node.getInfo());
+ }
+ }
+
+ public static class RelPrepPos extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR)+prepConcrete(node)+"->"+InfoGetFields.getPartOfSpeech(node.getInfo());
+ }
+ }
+
+ public static class RelCanonicalPos extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR)+"->"+node.getInfo().getNodeInfo().getSyntacticInfo().getPartOfSpeech().getCanonicalPosTag();
+ }
+ }
+
+ public static class RelPrepCanonicalPos extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR)+prepConcrete(node)+"->"+node.getInfo().getNodeInfo().getSyntacticInfo().getPartOfSpeech().getCanonicalPosTag();
+ }
+ }
+
+ public static class WordRel extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR)+"->"+InfoGetFields.getWord(node.getInfo());
+ }
+ }
+
+ public static class WordRelPos extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR)+"->"+InfoGetFields.getWord(node.getInfo())+"/"+InfoGetFields.getPartOfSpeech(node.getInfo());
+ }
+ }
+
+ public static class WordRelCanonicalPos extends NodeShortString {
+ @Override
+ public String toString(AbstractNode extends I, ?> node) {
+ return InfoGetFields.getRelation(node.getInfo(), ROOT_STR)+"->"+InfoGetFields.getWord(node.getInfo())+"/"+node.getInfo().getNodeInfo().getSyntacticInfo().getPartOfSpeech().getCanonicalPosTag();
+ }
+ }
+}
diff --git a/common/src/main/java/eu/excitementproject/eop/common/representation/parse/tree/dependency/view/TreeStringGenerator.java b/common/src/main/java/eu/excitementproject/eop/common/representation/parse/tree/dependency/view/TreeStringGenerator.java
index c6af6dbc..333fad90 100755
--- a/common/src/main/java/eu/excitementproject/eop/common/representation/parse/tree/dependency/view/TreeStringGenerator.java
+++ b/common/src/main/java/eu/excitementproject/eop/common/representation/parse/tree/dependency/view/TreeStringGenerator.java
@@ -16,6 +16,18 @@
* The graphical representation is merely several text lines, with characters
* like "|" and "-" to represent edges, and the string produced by
* a {@link NodeString} object.
+ *
+ * Example output for the sentence "De Villepin made no comment on arrival.":