mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am cb368a6d: Fix: Probability used for one word contextual phrase.
* commit 'cb368a6dac1d3148785da4fd8572bb79847c2ad1': Fix: Probability used for one word contextual phrase.
This commit is contained in:
commit
ff6e967b48
@ -622,9 +622,7 @@ public class DictionaryFacilitator {
|
|||||||
}
|
}
|
||||||
PrevWordsInfo prevWordsInfo = PrevWordsInfo.BEGINNING_OF_SENTENCE;
|
PrevWordsInfo prevWordsInfo = PrevWordsInfo.BEGINNING_OF_SENTENCE;
|
||||||
for (int i = 0; i < phrase.length; i++) {
|
for (int i = 0; i < phrase.length; i++) {
|
||||||
if (i < phrase.length - 1) {
|
final String[] subPhrase = Arrays.copyOfRange(phrase, i /* start */, phrase.length);
|
||||||
final String[] subPhrase =
|
|
||||||
Arrays.copyOfRange(phrase, i /* start */, phrase.length);
|
|
||||||
final String subPhraseStr = TextUtils.join(Constants.WORD_SEPARATOR, subPhrase);
|
final String subPhraseStr = TextUtils.join(Constants.WORD_SEPARATOR, subPhrase);
|
||||||
contextualDict.addUnigramEntryWithCheckingDistracter(
|
contextualDict.addUnigramEntryWithCheckingDistracter(
|
||||||
subPhraseStr, probability, null /* shortcutTarget */,
|
subPhraseStr, probability, null /* shortcutTarget */,
|
||||||
@ -635,7 +633,7 @@ public class DictionaryFacilitator {
|
|||||||
contextualDict.addNgramEntry(prevWordsInfo, subPhraseStr,
|
contextualDict.addNgramEntry(prevWordsInfo, subPhraseStr,
|
||||||
bigramProbabilityForPhrases, BinaryDictionary.NOT_A_VALID_TIMESTAMP);
|
bigramProbabilityForPhrases, BinaryDictionary.NOT_A_VALID_TIMESTAMP);
|
||||||
|
|
||||||
}
|
if (i < phrase.length - 1) {
|
||||||
contextualDict.addUnigramEntryWithCheckingDistracter(
|
contextualDict.addUnigramEntryWithCheckingDistracter(
|
||||||
phrase[i], probability, null /* shortcutTarget */,
|
phrase[i], probability, null /* shortcutTarget */,
|
||||||
Dictionary.NOT_A_PROBABILITY /* shortcutFreq */,
|
Dictionary.NOT_A_PROBABILITY /* shortcutFreq */,
|
||||||
@ -644,6 +642,7 @@ public class DictionaryFacilitator {
|
|||||||
DistracterFilter.EMPTY_DISTRACTER_FILTER);
|
DistracterFilter.EMPTY_DISTRACTER_FILTER);
|
||||||
contextualDict.addNgramEntry(prevWordsInfo, phrase[i],
|
contextualDict.addNgramEntry(prevWordsInfo, phrase[i],
|
||||||
bigramProbabilityForWords, BinaryDictionary.NOT_A_VALID_TIMESTAMP);
|
bigramProbabilityForWords, BinaryDictionary.NOT_A_VALID_TIMESTAMP);
|
||||||
|
}
|
||||||
prevWordsInfo = new PrevWordsInfo(phrase[i]);
|
prevWordsInfo = new PrevWordsInfo(phrase[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user