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

Add support for toggling / suspending transliteration #94

Open
akprasad opened this issue Jan 1, 2024 · 1 comment
Open

Add support for toggling / suspending transliteration #94

akprasad opened this issue Jan 1, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers lipi

Comments

@akprasad
Copy link
Contributor

akprasad commented Jan 1, 2024

Problem

Sanscript supports a handy feature: if the user types ##, transliteration is disabled until the ## block is seen again. Or for another version of this, some transliterators support suspending transliteration when < is seen and enabling it again when > is seen.

vidyut-lipi does not support this behavior, so it does not have parity with Sanscript.js

Proposed solution

Don't modify our core transliteration logic (transliterate_from_alphabet, transliterate_from_abugida) directly. Instead, modify the transliterate function to create a string slice if a toggler/suspender is seen, perhaps like so:

if let Some(i) = chars.position(|c| c == '<') {
  let slice = input[..i];
  // then, transliterate `slice` and append it to the output.
}

Supporting this behavior will also require updating the transliterate API to support an Options argument that lets the user set various flags. Rather than update transliterate, I suggest creating a new transliterate_with_options function (or method, if updating Lipika as well).

@akprasad akprasad added enhancement New feature or request good first issue Good for newcomers lipi labels Jan 1, 2024
@akprasad
Copy link
Contributor Author

On reflection, this seems right for the application layer but wrong for the library layer. But, perhaps we need some basic support of ## for ITRANS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers lipi
Projects
None yet
Development

No branches or pull requests

1 participant