@SuppressWarnings("unchecked") public Phrase createPhrase(ITree<?> t, IConstituent<?> cons, int c) { int begin = cons.getBeginIndex(); int end = cons.getEndIndex(); ISentence s = t.createSubStructure(begin, end); return new Phrase(s, t.getConstituentStructure().get(c).getFirst()); }
@SuppressWarnings("unchecked") @Override public double computeCombinedProbability( ITree<?> t, Vector<IConstituent<?>> vc, ProbabilityStore prob) { double p = -Math.log((double) 1); int size = 0; Phrase phrase = new Phrase(null, null); for (IConstituent c : vc) { phrase.first = t.createSubStructure(c.getBeginIndex(), c.getEndIndex()); phrase.second = c.getFirst(); double r = computeProbability(phrase, prob); c.setLocalScore(t.getSequenceId(), r); p += r; size++; } if (size != 0) { double result = p / size; return result; } return -1; }