FleksyLib

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.

Summary

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

Constructors

FleksyLib

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

Functions

addPhrasesToDictionary

fun addPhrasesToDictionary(phrases: List<String>)

Add phrases to the dictionary.

Parameters
phrases: List<String> The list of phrases to add to the dictionary.

addUserDictionaryWords

fun addUserDictionaryWords(words: List<String>)

Add words to the user dictionary.

Parameters
words: List<String> List of words to add to the user dictionary.

currentWordPrediction

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.

currentWordPrediction

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.

nextWordPrediction

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.

reloadLanguageFile

fun reloadLanguageFile(languageFile: LanguageFile)

Reload language file. Dictionary and config are kept during this process.

Parameters
languageFile: LanguageFile The path to the new LanguageFile.

removePhrasesFromDictionary

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.

removeUserDictionaryWords

fun removeUserDictionaryWords(words: List<String>)

Remove words from user dictionary.

Parameters
words: List<String> List of words to remove from user dictionary.

swipePrediction

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.

If something needs to be added or if you find an error in our documentation, please let us know either on our GitHub or Discord.

Last updated on August 15, 2022