Search in sources :

Example 6 with MentionAnnotator

use of org.cogcomp.md.MentionAnnotator in project cogcomp-nlp by CogComp.

the class MentionDetectionTest method testHeadInference.

@Test
public void testHeadInference() {
    EREMentionRelationReader ereMentionRelationReader = null;
    try {
        String path = "src/test/resources/ERE";
        ereMentionRelationReader = new EREMentionRelationReader(EREDocumentReader.EreCorpus.ENR3, path, false);
        POSAnnotator posAnnotator = new POSAnnotator();
        MentionAnnotator mentionAnnotator = new MentionAnnotator();
        for (XmlTextAnnotation xta : ereMentionRelationReader) {
            TextAnnotation ta = xta.getTextAnnotation();
            ta.addView(posAnnotator);
            mentionAnnotator.addView(ta);
            if (ta.getView("MENTION").getNumberOfConstituents() < 60) {
                fail("Mention Head predicted performance dropped");
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : EREMentionRelationReader(edu.illinois.cs.cogcomp.nlp.corpusreaders.ereReader.EREMentionRelationReader) XmlTextAnnotation(edu.illinois.cs.cogcomp.core.datastructures.textannotation.XmlTextAnnotation) POSAnnotator(edu.illinois.cs.cogcomp.pos.POSAnnotator) MentionAnnotator(org.cogcomp.md.MentionAnnotator) TextAnnotation(edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation) XmlTextAnnotation(edu.illinois.cs.cogcomp.core.datastructures.textannotation.XmlTextAnnotation) Test(org.junit.Test)

Aggregations

POSAnnotator (edu.illinois.cs.cogcomp.pos.POSAnnotator)6 MentionAnnotator (org.cogcomp.md.MentionAnnotator)6 ChunkerAnnotator (edu.illinois.cs.cogcomp.chunker.main.ChunkerAnnotator)5 StanfordDepHandler (edu.illinois.cs.cogcomp.pipeline.handlers.StanfordDepHandler)5 POSTaggerAnnotator (edu.stanford.nlp.pipeline.POSTaggerAnnotator)5 ParserAnnotator (edu.stanford.nlp.pipeline.ParserAnnotator)5 ChunkerConfigurator (edu.illinois.cs.cogcomp.chunker.main.ChunkerConfigurator)4 TextAnnotation (edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation)4 Properties (java.util.Properties)4 Relation (edu.illinois.cs.cogcomp.core.datastructures.textannotation.Relation)2 ResourceConfigurator (edu.illinois.cs.cogcomp.core.resources.ResourceConfigurator)2 File (java.io.File)2 Datastore (org.cogcomp.Datastore)2 RelationAnnotator (org.cogcomp.re.RelationAnnotator)2 TextAnnotationBuilder (edu.illinois.cs.cogcomp.annotation.TextAnnotationBuilder)1 CommaLabeler (edu.illinois.cs.cogcomp.comma.CommaLabeler)1 Language (edu.illinois.cs.cogcomp.core.constants.Language)1 Constituent (edu.illinois.cs.cogcomp.core.datastructures.textannotation.Constituent)1 View (edu.illinois.cs.cogcomp.core.datastructures.textannotation.View)1 XmlTextAnnotation (edu.illinois.cs.cogcomp.core.datastructures.textannotation.XmlTextAnnotation)1