Skip to content
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

Feature request: Conditional space handling after predicted words based on following character #300

Open
gushmazuko opened this issue Feb 1, 2025 · 0 comments

Comments

@gushmazuko
Copy link
Contributor

Description

When using the lexical model's word predictions, a space is automatically inserted after selecting a predicted word (controlled by insertAfterWord in the model definition). However, this creates an issue when the user wants to type punctuation marks immediately after the word - the space remains, creating incorrect spacing (e.g., "word , next" instead of "word, next").

Current Behavior

  1. User starts typing a word
  2. Selects a word from predictions
  3. A space is automatically inserted (as defined by insertAfterWord)
  4. When typing a punctuation mark, the space remains, creating incorrect spacing

Desired Behavior

  1. User starts typing a word
  2. Selects a word from predictions
  3. A space is automatically inserted
  4. If the next character typed is a punctuation mark (.,!?:;), the space should be automatically removed
  5. If the next character is a letter or number, the space should remain

Use Case

This behavior is standard in most mobile keyboards and is particularly important for languages where punctuation marks should be attached directly to the preceding word.

Current Workaround

Currently, users need to manually delete the space before typing punctuation marks, which reduces typing efficiency and creates a poor user experience.

Technical Details

The current model definition only allows for a static insertAfterWord value:

punctuation: {
  insertAfterWord: " "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant