/** @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 SpellingAnomaly(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
sentence)) { FSArray suggestedActions = anomaly.getSuggestions(); int n = suggestedActions.size(); FSArray newActions = new FSArray(jcas, n + 1); newAction.setReplacement(anomaly.getCoveredText()); newAction.setCertainty((float) getSentenceProbability(tokenStrings)); newActions.set(n, newAction); anomaly.setSuggestions(newActions);
SpellingAnomaly anomaly = new SpellingAnomaly(jcas, t.getBegin(), t.getEnd()); i++; anomaly.setSuggestions(actions); anomaly.addToIndexes();
/** * 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; } }
/** @generated * @param jcas JCas to which this Feature Structure belongs */ public SpellingAnomaly(JCas jcas) { super(jcas); readObject(); }
sentence)) { FSArray suggestedActions = anomaly.getSuggestions(); int n = suggestedActions.size(); FSArray newActions = new FSArray(jcas, n + 1); newAction.setReplacement(anomaly.getCoveredText()); newAction.setCertainty((float) getSentenceProbability(tokenStrings)); newActions.set(n, newAction); anomaly.setSuggestions(newActions);
SpellingAnomaly anomaly = new SpellingAnomaly(jcas, t.getBegin(), t.getEnd()); i++; anomaly.setSuggestions(actions); anomaly.addToIndexes();
/** Internal - constructor used by generator * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public SpellingAnomaly(int addr, TOP_Type type) { super(addr, type); readObject(); }