/** @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public SuggestedAction(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
SuggestedAction action = (SuggestedAction) suggestedActions.get(i); List<String> changedWords = getChangedWords(action.getReplacement(), tokenStrings, getCandidatePosition(anomaly, tokens)); action.setCertainty((float) probability); newActions.set(i, action); SuggestedAction newAction = new SuggestedAction(jcas); newAction.setReplacement(anomaly.getCoveredText()); newAction.setCertainty((float) getSentenceProbability(tokenStrings)); newActions.set(n, newAction);
int i = 0; for (SuggestionCostTuple tuple : tuples) { SuggestedAction action = new SuggestedAction(jcas); action.setReplacement(tuple.getSuggestion()); action.setCertainty(tuple.getNormalizedCost(tuples.getMaxCost()));
/** * Just gets the Suggestion with the highest Certainty. In case there are more suggestions with * certainty 100, it passes the first highest one. * * @param anomaly * the anomaly. * @return the best suggestion. */ private String getBestSuggestion(SpellingAnomaly anomaly) { Float bestCertainty = 0.0f; String bestReplacement = ""; for (int i = 0; i < anomaly.getSuggestions().size(); i++) { Float currentCertainty = anomaly.getSuggestions(i).getCertainty(); String currentReplacement = anomaly.getSuggestions(i).getReplacement(); if (currentCertainty > bestCertainty) { bestCertainty = currentCertainty; bestReplacement = currentReplacement; } if (bestCertainty == 100) { break; } } return bestReplacement; } }
/** Internal - constructor used by generator * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public SuggestedAction(int addr, TOP_Type type) { super(addr, type); readObject(); }
SuggestedAction action = (SuggestedAction) suggestedActions.get(i); List<String> changedWords = getChangedWords(action.getReplacement(), tokenStrings, getCandidatePosition(anomaly, tokens)); action.setCertainty((float) probability); newActions.set(i, action); SuggestedAction newAction = new SuggestedAction(jcas); newAction.setReplacement(anomaly.getCoveredText()); newAction.setCertainty((float) getSentenceProbability(tokenStrings)); newActions.set(n, newAction);
int i = 0; for (SuggestionCostTuple tuple : tuples) { SuggestedAction action = new SuggestedAction(jcas); action.setReplacement(tuple.getSuggestion()); action.setCertainty(tuple.getNormalizedCost(tuples.getMaxCost()));
/** @generated * @param jcas JCas to which this Feature Structure belongs */ public SuggestedAction(JCas jcas) { super(jcas); readObject(); }