new TypePathExtractor(AssertionCuePhraseAnnotation.class, "cuePhrase"),
new TypePathExtractor(AssertionCuePhraseAnnotation.class, "cuePhraseCategory"),
new TypePathExtractor(AssertionCuePhraseAnnotation.class, "cuePhraseAssertionFamily")
);
CleartkExtractor cuePhraseInWindowExtractor =
new CleartkExtractor(
AssertionCuePhraseAnnotation.class,
baseExtractorCuePhraseCategory,
new CleartkExtractor.Bag(new CleartkExtractor.Preceding(5)),
new CleartkExtractor.Bag(new CleartkExtractor.Following(5))
);
// new CleartkExtractor.Ngram(new CleartkExtractor.Preceding(5), new CleartkExtractor.Following(5)));
//new CoveredTextExtractor(),
// new CleartkExtractor.Covered());
// new CleartkExtractor.Preceding(5),
// new CleartkExtractor.Following(5));
List<CleartkExtractor> extractorList = new ArrayList<CleartkExtractor>();
extractorList.add(cuePhraseInWindowExtractor);
//NamingExtractor cuePhraseInWindowNamingExtractor = new NamingExtractor("cuePhraseCategory__", cuePhraseInWindowExtractor);
Collection<IdentifiedAnnotation> identifiedAnnotations = JCasUtil.select(jcas, IdentifiedAnnotation.class);
for (IdentifiedAnnotation current : identifiedAnnotations)
{
if (!(current instanceof EntityMention) && !(current instanceof EventMention)) continue;
// otherwise current is an entity or event mention...
logger.info(String.format("identified annotation (event or entity) [%d-%d] \"%s\" [%s]", current.getBegin(), current.getEnd(), current.getCoveredText(), current.getClass().getName()));
Collection<Sentence> coveringSentences = entityToSentenceMap.get(current);
if (coveringSentences == null || coveringSentences.isEmpty())
{
logger.info("no covering sentences found!!! continuing with next entity/event...");
continue;
}
logger.info(String.format("covering sentence count: %d", coveringSentences.size()));
Sentence firstCoveringSentence = coveringSentences.iterator().next();
logger.info(String.format(
"first covering sentence: [%d-%d] \"%s\" (%s)",
firstCoveringSentence.getBegin(), firstCoveringSentence.getEnd(),
firstCoveringSentence.getCoveredText(),
firstCoveringSentence.getClass().getName()));
List<Feature> cuePhraseFeatures =
//cuePhraseInSentenceExtractor.extract(jcas, firstCoveringSentence);
cuePhraseInWindowExtractor.extractWithin(jcas, current, firstCoveringSentence);
//cuePhraseInWindowNamingExtractor.extract(jcas, current);
if (cuePhraseFeatures != null && !cuePhraseFeatures.isEmpty())
{
String featureDebugString = (cuePhraseFeatures == null) ? "(no cue phrase features)" : cuePhraseFeatures.toString();
logger.info("### cue phrase features: " + featureDebugString);