//this(projectName, modelName, mode, numberEntitiesBack, preferFirstReferent, SingletonNonReferentialResolver.getInstance(projectName,mode));
this(modelDirectory, modelName, mode, numberEntitiesBack, preferFirstReferent, new FixedNonReferentialResolver(nonReferentialProbability));
}
public DiscourseEntity resolve(MentionContext ec, DiscourseModel dm) {
DiscourseEntity de;
int ei = 0;
double nonReferentialProbability = nonReferentialResolver.getNonReferentialProbability(ec);
if (debugOn) {
System.err.println(this +".resolve: " + ec.toText() + " -> " + "null "+nonReferentialProbability);
}
for (; ei < getNumEntities(dm); ei++) {
de = dm.getEntity(ei);
if (outOfRange(ec, de)) {
break;
}
if (excluded(ec, de)) {
candProbs[ei] = 0;
if (debugOn) {
System.err.println("excluded "+this +".resolve: " + ec.toText() + " -> " + de + " " + candProbs[ei]);
}
}
else {
List<String> lfeatures = getFeatures(ec, de);
String[] features = lfeatures.toArray(new String[lfeatures.size()]);
try {
candProbs[ei] = model.eval(features)[sameIndex];
}
catch (ArrayIndexOutOfBoundsException e) {
candProbs[ei] = 0;
}
if (debugOn) {
System.err.println(this +".resolve: " + ec.toText() + " -> " + de + " ("+ec.getGender()+","+de.getGender()+") " + candProbs[ei] + " " + lfeatures);
}
}
if (preferFirstReferent && candProbs[ei] > nonReferentialProbability) {
ei++; //update for nonRef assignment
break;