jelmervdl
Both of these methods have a bootstrapping problem, but at this point in the MT for many languages we have enough data to get started. Previous iterations of ParaCrawl used things like document structure and overlap of named entities among sentences to identify matching pairs. But this is much less robust. I don't know how they solve this problem today for low-resource languages.
It is a bit of a question whether this is the way to go. You're downloading about 20mb to get all the plumbing + translation models necessary to translate a page. It would be okay if it were widespread enough that we can assume everyone already has these in their browser cache, but the trend is moving away from that model of caching[3].
* given your browser support wasm SIMD. So an x86 processor with SSE4.1, although M1 also seems to work. And no Safari, because they haven't implemented wasm SIMD[4].
[1] https://translatelocally.com/web/
[2] https://github.com/jelmervdl/translatelocally-web-ext/blob/m...
[3] https://developer.chrome.com/en/blog/http-cache-partitioning...
I also think that the domain and the type of language used on Wikipedia is pretty consistent which will help a lot with unseen sentences.
By no means are these models bad! It’s just that Wikipedia is a particularly easy test for them.
React pages are especially tricky to translate as the framework does not take kindly on external JavaScript swapping out text nodes. There’s code in the extension to work around that.
It’s because the translation engine requires at least SSSE3.1 instructions[1]. These are translated to wasm SIMD instructions[2] which are only enabled by browsers if the underlying hardware is there to execute these at least somewhat efficient.
[1] https://github.com/browsermt/bergamot-translator/issues/418
But I agree that this local experience should be the future. It’s good to have the control and independence.
The website isn’t pretty but it’s the same tech as the browser extension. It came out of the same research project.
But because its optimised native code, and not limited by single threaded wasm, waaay faster!
Edit disclosure: I worked on that project, and this software.
I maintain a forked version of the Firefox extension[^1] that doesn’t use any private apis (or telemetry). It is slightly different[^2], but uses the same libraries.
Disclosure: I work for one of the project partners and contributed to the Mozilla extension.
[^1]: https://addons.mozilla.org/en-GB/firefox/addon/translateloca...
[^2]: https://github.com/jelmervdl/translatelocally-web-ext#differ...
Mozilla implemented a REST service based on (an earlier version of) bergamot-translator [1]. You could use that as a replacement for the WASM component in the addon's code.
I also know of some full-page translation demo code that uses the python bindings of bergamot-translator [2]. That's basically a web proxy a la Goole Translate.
Lastly, marian, the translation software that's being used, has a web server as well [3]. It does not support HTML though.
EDIT: see also my earlier comment for using it with Node or Python [4], which you could use to implement a simple web API.
[1] https://github.com/mozilla/translation-service
[2] https://github.com/jerinphilip/tagtransfer
[1] https://pypi.org/project/mtdata/
[2] https://github.com/mozilla/firefox-translations-training/blo...
The translation code itself should work on mobile. It's just some javascript & wasm (albeit with SIMD instructions not implemented in Safari's WASM vm…)
I was experimenting with running the wasm version of bergamot-translator (the translation engine used by the addon) in node [2].
However, if you want more performance, using the Python library [3] or the native C++ interface [4] gets you further because the wasm build is limited to a single thread and thus a blocking interface, and can't use all the processor specific optimisations that are in the native builds.
EDIT: Another option is using translateLocally [5], which is a Qt desktop app based on bergamot-translator. It has a native messaging API that is designed as a much faster alternative to the wasm build for browser extensions, but it can also be used from Python [6].
[1] https://github.com/mozilla/firefox-translations-training
[2] https://gist.github.com/jelmervdl/a4c8b6b92ad88a885e1cbd51c6...
[3] https://colab.research.google.com/drive/1AHpgewVJBFaupwAbZq0...
[4] https://github.com/browsermt/bergamot-translator/blob/main/a...
[5] https://github.com/XapaJIaMnu/translateLocally
[6] https://github.com/XapaJIaMnu/translateLocally/blob/master/s...
(Edit: also free sandboxing of a blob of C++ code that needs to handle arbitrary input from the web!)