{"id":21458092,"url":"https://github.com/shubham0204/text-predictor-android","last_synced_at":"2025-07-11T01:09:48.306Z","repository":{"id":179881024,"uuid":"661836964","full_name":"shubham0204/text-predictor-android","owner":"shubham0204","description":"Next word prediction and word auto-complete for Android - with the power of Rust 🚀","archived":false,"fork":false,"pushed_at":"2024-02-25T02:18:14.000Z","size":14039,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T14:11:41.478Z","etag":null,"topics":["android","android-library","autocomplete-suggestions","data-structures","markov-model","rust","text-predictions","trie-data-structure"],"latest_commit_sha":null,"homepage":"https://shubham0204.github.io/text-predictor-android/android","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shubham0204.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"shubham0204","custom":["https://www.paypal.me/ShubhamPanchalDev"]}},"created_at":"2023-07-03T19:09:19.000Z","updated_at":"2025-04-10T07:05:31.000Z","dependencies_parsed_at":"2023-12-18T03:29:38.533Z","dependency_job_id":null,"html_url":"https://github.com/shubham0204/text-predictor-android","commit_stats":null,"previous_names":["shubham0204/text-predictor-android"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/shubham0204/text-predictor-android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2Ftext-predictor-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2Ftext-predictor-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2Ftext-predictor-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2Ftext-predictor-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shubham0204","download_url":"https://codeload.github.com/shubham0204/text-predictor-android/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2Ftext-predictor-android/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264703185,"owners_count":23651916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","autocomplete-suggestions","data-structures","markov-model","rust","text-predictions","trie-data-structure"],"created_at":"2024-11-23T06:17:40.922Z","updated_at":"2025-07-11T01:09:48.275Z","avatar_url":"https://github.com/shubham0204.png","language":"Kotlin","funding_links":["https://github.com/sponsors/shubham0204","https://www.paypal.me/ShubhamPanchalDev"],"categories":[],"sub_categories":[],"readme":"# Text Prediction in Android - With Rust 🚀\n\nPerform next-word prediction with text-autocompletion, all in Android. The library uses Rust internally, to bring \ntext-suggestions within a few-milliseconds. See the [rust]() branch for more details.\n\n* [Documentation](https://shubham0204.github.io/text-predictor-android/android/)\n\n## Installation\n\n1. Download `text-predictor.aar` from the latest release. (See [Releases](https://github.com/shubham0204/text-predictor-android/releases))\n2. Move the AAR to `app/libs`.\n3. In module-level `build.gradle`, add the dependency,\n\n```groovy\ndependencies {\n    ...\n    implementation files('libs/text-predictor.aar')\n    ...\n}\n```\n\n## Usage\n\nTo generate suggestions while text is being entered in a text-widget (could be a `EditText` or `TextField`), we use \nthe `stream` method available in the `TextPredictor` class. The `stream` method must be called inside on a `onTextChanged` or a \nsimilar callback that provides a string entered by the user.\n\nFor a Compose `TextField`,\n\n```kotlin\nval textPredictor = TextPredictor( this , results )\n\nvar inputString by remember{ mutableStateOf(\"\") }\nTextField(\n    modifier = modifier,\n    value = inputString,,\n    onValueChange = {\n        textPredictor.stream(it)\n        inputString = it\n    },\n    singleLine = true,\n)\n\nprivate val results: ((List\u003cString\u003e) -\u003e Unit) = { suggestions -\u003e\n    // Handle UI changes that display `suggestions`\n}\n```\n\nFor a `View`-based `EditText`, \n\n```kotlin\nval textPredictor = TextPredictor( this , results )\n\neditText.addTextChangedListener { it -\u003e\n    textPredictor.stream( it.toString() )\n}\n\nprivate val results: ((List\u003cString\u003e) -\u003e Unit) = { suggestions -\u003e\n    // Handle UI changes that display `suggestions`\n} \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubham0204%2Ftext-predictor-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshubham0204%2Ftext-predictor-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubham0204%2Ftext-predictor-android/lists"}