-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Predictive text #357
Open
flide
wants to merge
16
commits into
master
Choose a base branch
from
predictive_text
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Predictive text #357
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Artifact 8vim-debug available until: 2023-08-14T06:00:04Z |
MaethorNaur
approved these changes
Aug 1, 2023
the PR is not ready yet
…On Tue, Aug 1, 2023, 12:44 PM Pedro Mangabeira ***@***.***> wrote:
***@***.**** approved this pull request.
—
Reply to this email directly, view it on GitHub
<#357 (review)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABX5WR2WTGLXNRP3XICDRVDXTCUE3ANCNFSM6AAAAAA2WWF2DU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
…the manifest The READ_USER_DICTIONARY permission is added to the AndroidManifest.xml file to allow the application to read the user's dictionary. This permission is necessary for predictive text functionality within the app.
…nary words A temporary method to verify access to user's personal dictionary. The printUserDictionaryWords method is added to the MainInputMethodService class to print the words from the user dictionary. This method takes a ContentResolver as a parameter and queries the UserDictionary.Words.CONTENT_URI to retrieve the words. The words are then printed to the console. The onCreate method is refactored to call the printUserDictionaryWords method after setting the theme and before calling the super.onCreate method. This allows for the user dictionary words to be printed when the input method service is created.
… track the current word being typed The `onUpdateSelection` method is added to the `MainInputMethodService` class to track the current word being typed by the user. The method retrieves the text before the cursor and extracts the current word from it. The `getCurrentWord` method is also added to allow other parts of the code to retrieve the current word. This change improves the functionality of the input method service by providing access to the current word being typed.
…ctive text functionality The build.gradle file was modified to add the Apache Commons Text library as a dependency. This library is required for the new predictive text functionality. The MainInputMethodService.java file was modified to import the PredictiveTextHelper class and create an instance of it. This allows the IME to use the predictive text functionality. A new PredictiveTextHelper.java file was added to implement the predictive text functionality. This class loads dictionaries, extracts the current word from the text before the cursor, generates word suggestions based on the current word, and sorts the suggestions based on their similarity to the current word using the Levenshtein distance algorithm.
…ctionary from raw resource file The PredictiveTextHelper constructor now accepts a Context parameter instead of a ContentResolver. This change improves flexibility as it allows the PredictiveTextHelper class to be used in different contexts, not just limited to activities or services that have access to a ContentResolver. The loadEnglishDictionaryWords method in PredictiveTextHelper now loads the English dictionary from a raw resource file.
…n based on Levenshtein distance and word frequency In `PredictiveTextHelper.java`, the loading of the word frequency map from the file has been setup. The file is read line by line, and each line is split into word and frequency parts. The word and frequency are then added to the `wordFrequencyMap` map. The `generateWordSuggestions()` method is improved to generate word suggestions based on Levenshtein distance and word frequency. The method now uses the `getClosestWords()` method to get a list of candidate words based on Levenshtein distance. The candidate words are then sorted based on their frequencies and added to the `suggestedWords` list.
…d logging for debugging purposes
…words to 12 for better performance The number of suggested words is now limited to 12 to improve the performance of the PredictiveTextHelper class. By reducing the number of suggested words, the processing time and memory usage are optimized, resulting in a more efficient and responsive user experience.
…ggested words and set suggestions based on predictive text The unused import statement for android.util.Log has been removed to improve code cleanliness. The SuggestionView has been added to the MainInputMethodService to display suggested words based on predictive text. The SuggestionView is a custom view that sets the suggestions based on a list of strings. The suggestion_item.xml and suggestion_view.xml layout files have been created to define the appearance of individual suggestion items and the suggestion view container, respectively.
The changes in these files are purely cosmetic. Unused imports have been removed and the code has been reformatted to improve readability.
…nment The `android:baselineAligned` attribute is added to the `suggestion_view.xml` layout file to improve the alignment of the elements within the layout. This attribute ensures that the baseline of each element is aligned properly, resulting in a more visually appealing layout. This Also fixes the lint issues.
…s to SuggestionView The SuggestionViewActionListener class is added to handle actions related to the SuggestionView. The SuggestionView class now has an actionListener field of type SuggestionViewActionListener, which is initialized in the initialize() method. Additionally, onClick listeners are added to the suggestion TextViews to handle click events and call the appropriate action on the actionListener. These changes improve the functionality and interactivity of the SuggestionView component.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.