Skip to content

feat: use nouns table for alphabetical autocompletions (#596)#652

Open
prince-0408 wants to merge 1 commit intoscribe-org:mainfrom
prince-0408:feat/noun-table-alphabetical-autocompletions-596
Open

feat: use nouns table for alphabetical autocompletions (#596)#652
prince-0408 wants to merge 1 commit intoscribe-org:mainfrom
prince-0408:feat/noun-table-alphabetical-autocompletions-596

Conversation

@prince-0408
Copy link
Copy Markdown
Contributor

Summary

Implements the noun table fallback for alphabetical autocompletions as described in #596. When the autocomplete_lexicon returns no results (e.g. for a new language without a valid Trie structure), the keyboard now falls back to querying the nouns table directly using the language's data contract.

Closes #596

Changes

LanguageDBManager.swift

Method Type Description
queryNounAutocompletions(word:) New Loads the current language's data contract via ContractManager, extracts all singular key columns from the numbers section, builds a UNION ALL SQL query matching rows where the value starts with the typed prefix (case-insensitive LIKE), and returns up to 3 deduplicated, alphabetically sorted (COLLATE NOCASE ASC) results
queryAutocompletions(word:) Modified First queries autocomplete_lexicon as before (existing behaviour preserved) — falls back to queryNounAutocompletions(word:) when the lexicon returns empty results

How It Works Per Language

Each language's YAML contract defines the numbers section differently:

Language Singular Columns Searched
English, French, Portuguese, Italian singular
German, Russian nominativeSingular
Spanish masculineSingular, feminineSingular
Swedish nominativeIndefiniteSingular, nominativeDefiniteSingular

The implementation is fully contract-driven — it works automatically for any language that has a valid numbers section, including future languages.

- Add queryNounAutocompletions(word:) to LanguageDBManager that queries
  all singular (key) columns from the language data contract numbers
  section using a UNION ALL across those columns with LIKE prefix%
- Update queryAutocompletions(word:) to fall back to noun-based
  completions when the autocomplete_lexicon returns no results
- Results are deduplicated, sorted COLLATE NOCASE ASC, limited to 3

Closes scribe-org#596
@github-actions
Copy link
Copy Markdown

Thank you for the pull request! 💙🩵

The Scribe-iOS team will do our best to address your contribution as soon as we can. The following are some important points:

  • Those interested in developing their skills and expanding their role in the community should read the mentorship and growth section of the contribution guide
  • If you're not already a member of our public Matrix community, please consider joining!
    • We'd suggest that you use the Element client as well as Element X for a mobile app
    • Join the General and iOS rooms once you're in
  • Also consider attending our bi-weekly Saturday developer syncs!
    • Details are shared in the General room on Matrix each Wednesday before the sync
    • It would be great to meet you 😊

Note

Scribe uses Conventional Comments in reviews to make sure that communication is as clear as possible.

@github-actions
Copy link
Copy Markdown

Maintainer Checklist

The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

  • Tests for changes have been written and the CI unit test, linting and formatting workflows within the PR checks do not indicate new errors in the files changed

  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use nouns table for alphabetical autocompletions

1 participant