Parse[] mtokens = mention.getTokenParses();
Set<String> ecModSet = constructModifierSet(mtokens, mention.getHeadTokenIndex());
String mentionHeadString = mention.getHeadTokenText().toLowerCase();
Set<String> featureSet = new HashSet<String>();
for (Iterator<MentionContext> ei = entity.getMentions(); ei.hasNext();) {
MentionContext entityMention = ei.next();
String exactMatchFeature = getExactMatchFeature(entityMention, mention);
if (exactMatchFeature != null) {
featureSet.add(exactMatchFeature);
}
else if (entityMention.getParse().isCoordinatedNounPhrase() && !mention.getParse().isCoordinatedNounPhrase()) {
featureSet.add("cmix");
}
else {
String mentionStrip = stripNp(mention);
String entityMentionStrip = stripNp(entityMention);
if (mentionStrip != null && entityMentionStrip != null) {
if (isSubstring(mentionStrip, entityMentionStrip)) {
featureSet.add("substring");
}
}
}
Parse[] xtoks = entityMention.getTokenParses();
int headIndex = entityMention.getHeadTokenIndex();
//if (!mention.getHeadTokenTag().equals(entityMention.getHeadTokenTag())) {
// //System.err.println("skipping "+mention.headTokenText+" with "+xec.headTokenText+" because "+mention.headTokenTag+" != "+xec.headTokenTag);
// continue;
//} want to match NN NNP
String entityMentionHeadString = entityMention.getHeadTokenText().toLowerCase();
// model lexical similarity
if (mentionHeadString.equals(entityMentionHeadString)) {
sameHead = true;
featureSet.add("hds=" + mentionHeadString);
if (!modsMatch || !nonTheModsMatch) { //only check if we haven't already found one which is the same
modsMatch = true;
nonTheModsMatch = true;
Set<String> entityMentionModifierSet = constructModifierSet(xtoks, headIndex);
for (Iterator<String> mi = ecModSet.iterator(); mi.hasNext();) {
String mw = mi.next();
if (!entityMentionModifierSet.contains(mw)) {
modsMatch = false;
if (!mw.equals("the")) {
nonTheModsMatch = false;
featureSet.add("mmw=" + mw);
}
}
}
}
}
Set<String> descModSet = constructModifierSet(xtoks, entityMention.getNonDescriptorStart());
if (descModSet.contains(mentionHeadString)) {
titleMatch = true;
}
}
if (!featureSet.isEmpty()) {