more fine-tunning
This commit is contained in:
parent
b0d5fb3af3
commit
dbf943d18a
2 changed files with 15 additions and 3 deletions
|
|
@ -146,7 +146,7 @@ public class SuggestionsBar {
|
||||||
|
|
||||||
|
|
||||||
private void setStem(List<String> newSuggestions, boolean containsGenerated) {
|
private void setStem(List<String> newSuggestions, boolean containsGenerated) {
|
||||||
if (newSuggestions == null || newSuggestions.isEmpty()) {
|
if (newSuggestions == null || newSuggestions.size() < 2) {
|
||||||
stem = "";
|
stem = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -156,6 +156,18 @@ public class SuggestionsBar {
|
||||||
// Do not modify single letter + punctuation, such as "j'" or "l'". They look better as they are.
|
// Do not modify single letter + punctuation, such as "j'" or "l'". They look better as they are.
|
||||||
stem = (stem.length() == 1 && newSuggestions.get(0).length() == 2 && !Character.isAlphabetic(newSuggestions.get(0).charAt(1))) ? "" : stem;
|
stem = (stem.length() == 1 && newSuggestions.get(0).length() == 2 && !Character.isAlphabetic(newSuggestions.get(0).charAt(1))) ? "" : stem;
|
||||||
|
|
||||||
|
// If no other suggestion contains the stem, it makes no sense to separate them and display:
|
||||||
|
// "STEM" + "one-suggestion". It is only useful when there are multiple suggestions with the
|
||||||
|
// same stem.
|
||||||
|
boolean onlyOneContainsStem = true;
|
||||||
|
for (int i = 1; i < newSuggestions.size(); i++) {
|
||||||
|
if (newSuggestions.get(i).contains(stem)) {
|
||||||
|
onlyOneContainsStem = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stem = onlyOneContainsStem ? "" : stem;
|
||||||
|
|
||||||
if (!stem.isEmpty() && !newSuggestions.contains(stem)) {
|
if (!stem.isEmpty() && !newSuggestions.contains(stem)) {
|
||||||
suggestions.add(stem + STEM_SUFFIX);
|
suggestions.add(stem + STEM_SUFFIX);
|
||||||
selectedIndex++;
|
selectedIndex++;
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ public class Characters {
|
||||||
));
|
));
|
||||||
|
|
||||||
final public static ArrayList<Character> CombiningPunctuation = new ArrayList<>(Arrays.asList(
|
final public static ArrayList<Character> CombiningPunctuation = new ArrayList<>(Arrays.asList(
|
||||||
',', '-', '\'', ';', '!', '?', '.'
|
',', '-', '\'', ':', ';', '!', '?', '.'
|
||||||
));
|
));
|
||||||
|
|
||||||
final public static ArrayList<Character> CombiningPunctuationHebrew = new ArrayList<>(Arrays.asList(
|
final public static ArrayList<Character> CombiningPunctuationHebrew = new ArrayList<>(Arrays.asList(
|
||||||
',' , '-', '\'', ';', '!', '?', '.', '"'
|
',' , '-', '\'', ':', ';', '!', '?', '.', '"'
|
||||||
));
|
));
|
||||||
|
|
||||||
final public static ArrayList<String> PunctuationArabic = new ArrayList<>(Arrays.asList(
|
final public static ArrayList<String> PunctuationArabic = new ArrayList<>(Arrays.asList(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue