-
Notifications
You must be signed in to change notification settings - Fork 3
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
Show original sentence on hover #5
Comments
I was thinking about this, because it would also be useful during development. But I have no idea how to do it right now. You'd need to identify which sentence you're hovering over. That means going
Okay maybe it is doable. Google figured it out… But it feels like a major undertaking. |
Oh, I know how they did it (because I used it to get some seed data to train a translation model at some point). They projected what was one node earlier to two nodes (In our case this would mean we modify "sentences"). You'll already know the following at construction (C++).
Your HTML pipeline can potentially inject these dummy nodes and wrap a dummy element around them. Target would be Could be a flag to begin with while experimenting, then open once stable. Edit: I guess we may or may not be using |
Looked at it on https://www.coderepublics.com/howto/how-to-google-translate.php What Google seems to do is wrap the text node in a I think they picked |
Related: https://github.com/jelmervdl/bergamot-translator/tree/html-embed-original-sentence I'd rather not use the "add font tags everywhere with metadata" way of implementing this as it breaks React websites since we can't properly re-use text nodes in the page for the translated text without modifying the DOM tree too much. … But I don't know another way of implementing it. Storing sentences by offsets somewhere sounds really difficult for a tree. As does determining at which offset we would be when hovering over some translated text. |
So the old Google Translate web used to be able to pop out a bubble showing the original text. I always thought this a valuable feature when it was available.
The sentence byte-range annotations in
Response
are envisioned to be used for this (aside from its use in quality annotations).Could you implement this feature if it's not too much (using
Response.source[idx]
corresponding toResponse.target[idx]
). I expect this to be hard given HTML in place doing things. I'd expect plaintext to be easier, to begin with, and in pursuit of an equivalent for HTML, the bergamot-translator library's HTML / sentence demarcations/notions can also potentially improve.An over the page show original button could also be useful.
The text was updated successfully, but these errors were encountered: