mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-16 16:29:32 -06:00
the list of alternatives in the translator is now sorted by probability
This commit is contained in:
@@ -589,7 +589,18 @@ public class Translator {
|
||||
}
|
||||
|
||||
public List<MorphoAnalysis> lookupMorpho(String sentence) {
|
||||
return getSourceConcr().lookupMorpho(sentence);
|
||||
List<MorphoAnalysis> ans = getSourceConcr().lookupMorpho(sentence);
|
||||
Collections.sort(ans, new Comparator<MorphoAnalysis>() {
|
||||
public int compare(MorphoAnalysis a1, MorphoAnalysis a2) {
|
||||
if (a1.getProb() > a2.getProb())
|
||||
return 1;
|
||||
else if (a1.getProb() < a2.getProb())
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
return ans;
|
||||
}
|
||||
|
||||
public CompletionInfo[] lookupWordPrefix(String prefix) {
|
||||
|
||||
Reference in New Issue
Block a user