protected Candidate pickTop(List<ScoreLabel> scoreLabels) throws NullPointerException { if (scoreLabels.size() == 0) throw new NullPointerException("\nError:\nThe list of candidates is empty."); ScoreLabel topScoreLabel = scoreLabels.get(0); Candidate topCand = topScoreLabel.getC(); double topOpScore = topScoreLabel.getScore(); for (int i = 1; i < scoreLabels.size(); i++) { ScoreLabel temp = scoreLabels.get(i); if (temp.getScore() > topOpScore) { topOpScore = temp.getScore(); topCand = temp.getC(); } } return topCand; }
protected List<ScoreLabel> initScoreLabels(List<Integer> feats) throws Exception { List<ScoreLabel> scoreLabels = new ArrayList<ScoreLabel>(); for (Integer label : LabelLib.getCandidateLabels()) { registerAllFeaturesForLabel(feats, label); ScoreLabel sc = new ScoreLabel(labelToCandidate.get(label)); sc.setScore(sc.getC().getScore(feats)); scoreLabels.add(sc); } return scoreLabels; }