class FleksyLib
The FleksyLib class is the main way to interact with the Fleksy Core SDK. You need to create an instance of FleksyLib to start using the autocorrection, next word prediction, and swipe functionalities.
Constructors | |
---|---|
FleksyLib( applicationContext: Context, languageFile: LanguageFile, libraryConfiguration: LibraryConfiguration ) |
Functions | |
---|---|
Void | addPhrasesToDictionary(words: List<String>) Add phrases to the dictionary. |
Void | addUserDictionaryWords(words: List<String>) Add words to the user dictionary. |
Result<List<Candidate>> | currentWordPrediction(context: TypingContext) Given a specific typing context, predicts the words and emojis the user is trying to type. |
Result<List<Candidate>> | currentWordPrediction( context: TypingContext, currentWordTaps: List<LayoutPoint> ) Given a specific typing context, predicts the words and emojis the user is trying to type. |
Result<List<Candidate>> | nextWordPrediction(context: TypingContext) Given a specific text, suggests the next possible words and emojis the user is likely to type |
Void | reloadLanguageFile(languageFile: LanguageFile) Reload language file. Dictionary and config are kept during this process. |
Void | removePhrasesFromDictionary(phrases: List<String>) The list of phrases to remove from the dictionary. |
Void | removeUserDictionaryWords(words: List<String>) Remove words from user dictionary. |
Result<List<Candidate>> | swipePrediction(context: TypingContext) Given a context and an array of positions, predicts the words the user likely swiped |
FleksyLib(
applicationContext: Context,
languageFile: LanguageFile,
libraryConfiguration: LibraryConfiguration
)
Parameters | |
---|---|
applicationContext: Context | Context of the application |
languageFile: LanguageFile | Default language file |
libraryConfiguration: LibraryConfiguration | LibraryConfiguration containing user’s license and secret key in a LicenseConfiguration object |
fun addPhrasesToDictionary(phrases: List<String>)
Add phrases to the dictionary.
Parameters | |
---|---|
phrases: List<String> | The list of phrases to add to the dictionary. |
fun addUserDictionaryWords(words: List<String>)
Add words to the user dictionary.
Parameters | |
---|---|
words: List<String> | List of words to add to the user dictionary. |
suspend fun currentWordPrediction(context: TypingContext): Result<List<Candidate>>
Given a specific typing context, predicts the words and emojis the user is trying to type.
Parameters | |
---|---|
context: TypingContext | The text context to be corrected. |
Returns | |
---|---|
Result<List<Candidate>> | The array of ‘Candidate’ for the autocorrection in case of success. |
suspend fun currentWordPrediction(
context: TypingContext,
currentWordTaps: List<LayoutPoint>
): Result<List<Candidate>>
Given a specific text and a list of points where the user tapped, predicts the words and emojis the user is trying to type.
Parameters | |
---|---|
context: TypingContext | The text context to be corrected. |
currentWordTaps: List<LayoutPoint>> | The list of the user tap interactions that correspond to the current word to autocorrect. |
Returns | |
---|---|
Result<List<Candidate>> | The list of ‘Candidate’ for the autocorrection in case of success. |
suspend fun nextWordPrediction(context: TypingContext): Result<List<Candidate>>
Given a specific text, suggests the next possible words and emojis the user is likely to type.
Parameters | |
---|---|
context: TypingContext | The text used for the next word prediction. |
Returns | |
---|---|
Result<List<Candidate>> | The list of ‘Candidate’ for the next word prediction in case of success. |
fun reloadLanguageFile(languageFile: LanguageFile)
Reload language file. Dictionary and config are kept during this process.
Parameters | |
---|---|
languageFile: LanguageFile | The path to the new LanguageFile. |
fun removePhrasesFromDictionary(phrases: List<String>)
Remove auto learned words from user dictionary.
Parameters | |
---|---|
phrases: List<String> | The list of phrases to remove from the dictionary. |
fun removeUserDictionaryWords(words: List<String>)
Remove words from user dictionary.
Parameters | |
---|---|
words: List<String> | List of words to remove from user dictionary. |
suspend fun swipePrediction(
context: TypingContext,
swipePoints: List<LayoutPoint>
): Result<List<Candidate>>
Given a context and an array of positions, predicts the words the user likely swiped
Parameters | |
---|---|
context: TypingContext | The text context used for the swipe prediction. |
swipePoints: List<LayoutPoint>> | A list of ‘LayoutPoint’ containing the information of the swipe |
Returns | |
---|---|
Result<List<Candidate>> | The list of ‘Candidate’ for the swipe prediction in case of success. |