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

Updated configuration for html text translation to work in wasm test page #269

Merged
merged 2 commits into from
Dec 1, 2021

Conversation

abhi-agg
Copy link
Contributor

@abhi-agg abhi-agg commented Nov 30, 2021

Added alignment: soft during translator construction as per #266 (comment) and ResponseOptions::alignment to true as per #266 (comment)

Both of these changes were required for the html text translation to work. Only providingalignment: soft during translator construction and not setting ResponseOptions::alignment to true doesn't give correct results.

@jerinphilip
Copy link
Contributor

jerinphilip commented Nov 30, 2021

Can you please post a few screenshots confirming this works? I'm looking for examples where @jelmervdl's length based approximations are not giving a false pretence of a working HTML translation.

I'd expect ResponseOptions.alignment to be required to set to true for buildAlignments to be run. HTML.Restore I expect consumes the product of buildAlignments.

 - Had to be set for html text translation to work
@abhi-agg abhi-agg changed the title Updated translator configuration in wasm test page Updated configuration for html text translation to work in wasm test page Nov 30, 2021
@jerinphilip
Copy link
Contributor

Hello, an update. ResponseOptions.alignment will need to be set for the time being. I had an issue with my python package (loading from a venv instead of my source).

With options incorrect
Source
[src]  In early 2018, security researchers disclosed two major vulnerabilities, known as <a href="https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability)" target="_blank">Meltdown</a> and <a href="https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)" target="_blank">Spectre</a>.
[hyp]  Anfang 2018 enthüllten Sicherheitsforscher zwei große Schwachstellen, bekannt als Meltdown <a href="https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability)" target="_blank">und Spec</a>tre<a href="https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)" target="_blank">.</a>


[src] >  <p>I <b>like</b> to <i>drive</i> this car.</p>
[hyp] >  <p>Ich <b></b>fahrer<i>e dieses</i> Auto gerne.</p>
Render

[src] In early 2018, security researchers disclosed two major vulnerabilities, known as Meltdown and Spectre.
[hyp] Anfang 2018 enthüllten Sicherheitsforscher zwei große Schwachstellen, bekannt als Meltdown und Spectre.

[src]

I like to drive this car.


[hyp]

Ich fahrere dieses Auto gerne.

With correct options:
Source
[src] In early 2018, security researchers disclosed two major vulnerabilities, known as <a href="https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability)" target="_blank">Meltdown</a> and <a href="https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)" target="_blank">Spectre</a>.
[hyp] Anfang 2018 enthüllten Sicherheitsforscher zwei große Schwachstellen, bekannt als <a href="ttps://en.wikipedia.org/wiki/Meltdown_(security_vulnerability)" target="_blank">Meltdown</a> und <a href="https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)" target="_blank">Spectre.</a>


[src]   <p>I <b>like</b> to <i>drive</i> this car.</p>
[hyp]  <p>Ich <i>fahrere</i> dieses Auto gerne.</p>

Render

[src] In early 2018, security researchers disclosed two major vulnerabilities, known as Meltdown and Spectre.
[hyp] Anfang 2018 enthüllten Sicherheitsforscher zwei große Schwachstellen, bekannt als Meltdown und Spectre.

[src]

I like to drive this car.


[hyp]

Ich fahrere dieses Auto gerne.

@abhi-agg
Copy link
Contributor Author

I have attached Wasm test page screenshot that translates the highlighted text from the wikipedia webpage. It is a bit difficult to read everything in the wasm test page. So I copied both source and translation in https://wordtohtml.net/ that gives nicely formatted html and attached the screenshot for that as well.

The highlighted text from the wikipedia webpage:

Wikipedia-Source-Text

Wasm test page:

wasm-test-page

wordtohtml:
wordToHtml-result

@kpu
Copy link
Member

kpu commented Nov 30, 2021

I'm confused as to why we're making Abhishek bend around configuring things. If HTML is set we turn alignments on.

@abhi-agg
Copy link
Contributor Author

abhi-agg commented Nov 30, 2021

Is there a performance penalty if alignment: soft is always provided (during translator construction as it is right now) but user never translates html text but only plain text?

If not, then alignment: soft could become the default, relieving user from specifying it explicitly during translator construction. This way, whenever user provides ResponseOptions::HTML as true during translate call, the html text translation kicks in (I think that's what Kenneth means above?). Otherwise plain text translation kicks in.

@kpu
Copy link
Member

kpu commented Nov 30, 2021

There is a speed penalty having alignment: soft (as opposed to one). Could also be a RAM penalty but we're loading the full file anyway. I'm not sure how big it is. For firefox it may as well always be on though. We should always calculate alignments if HTML is on and you shouldn't need to configure both at the request level.

@abhi-agg
Copy link
Contributor Author

abhi-agg commented Dec 1, 2021

Thanks @kpu for the explanation. I am going ahead with merging this one to have the main branch working for html text translation. I will change config again based on the outcome of #270 👍🏾

@abhi-agg abhi-agg merged commit 8e79897 into browsermt:main Dec 1, 2021
@abhi-agg abhi-agg deleted the wasm-test-page-config-update branch December 1, 2021 10:32
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.

3 participants