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

Context support #9

Open
domenic opened this issue May 10, 2024 · 0 comments
Open

Context support #9

domenic opened this issue May 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@domenic
Copy link
Collaborator

domenic commented May 10, 2024

It's often useful to give context when doing translations. For example, "Turkey" might be translated as 七面鳥 or as トルコ depending on the context.

I've found some evidence of people attempting to give context to non-LLM translation models by using punctuation and sentence structure. For example, if you translate "Togo" by itself with Google Translate, you get "持ち帰り" (basically, "take out" or "to go" for food orders). But if you translate "The country: Togo", you get "国: トーゴ", which is correct. People then build hacks on top of this, hoping that the output stays consistent across slightly varied inputs so that they can use regular expressions or other programming tricks to pull out the "トーゴ" part.

This is fragile. For example, translating "The country: America" gives "国:アメリカ". This is also correct, but the colon punctuation is different: it's a full-width (Japanese) colon for this second example, instead of a half-width (Latin script) colon. So a developer's first-draft code would not work.

It would be ideal if we could abstract over this process for developers, using something like

translator.translate("Togo", { context: "%s is a country name" });
@domenic domenic added the enhancement New feature or request label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant