Cross platform C++ library focusing on optimized machine translation on the consumer-grade device.
Go to file
Jerin Philip 576afae6b3
Adding documentation action (#168)
Adds a GitHub workflow that builds documentation from sources through doxygen through sphinx on push to the main branch or on push of any semantic version tags. The built documentation is deployed at https://github.com/browsermt/docs@gh-pages, which is rendered at https://browser.mt/docs/<suffix>, where <suffix> is 'main' or a tag vM.m.p corresponding to a semantic version.

On pull request artifacts are uploaded for reviewers to inspect if need be.
2021-05-25 11:10:56 +01:00
.circleci Avoid packaging vocab files into wasm binary in CI builds 2021-05-12 09:55:49 +02:00
.github/workflows Adding documentation action (#168) 2021-05-25 11:10:56 +01:00
3rd_party Marian submodule with unified loading (#157) 2021-05-18 12:45:22 +01:00
app Collapsing TranslationRequest -> ResponseOptions (#139) 2021-05-18 14:25:25 +01:00
bergamot-translator-tests@636af01c63 Bumping BRT for hotfixes (#169) 2021-05-20 12:49:44 +01:00
cmake Added cmake file to compute version information 2021-05-17 19:34:58 +02:00
doc Adding clang-format and updating existing sources to adhere (#151) 2021-05-19 21:50:21 +01:00
scripts/ci Enabling ccache on github builds for Ubuntu (#95) 2021-05-17 11:42:47 +01:00
src Remove O(N^2) reallocation (#171) 2021-05-22 00:04:49 +01:00
wasm Adding clang-format and updating existing sources to adhere (#151) 2021-05-19 21:50:21 +01:00
.clang-format Adding clang-format and updating existing sources to adhere (#151) 2021-05-19 21:50:21 +01:00
.clang-format-ignore Adding clang-format and updating existing sources to adhere (#151) 2021-05-19 21:50:21 +01:00
.gitignore Imported CI scripts from mozilla/bergamot-translator-old (#1) 2021-03-10 09:30:39 -08:00
.gitmodules Moving small tests to GitHub CI (#93) 2021-04-16 11:58:53 +01:00
BERGAMOT_VERSION Corrected the version number 2021-05-18 12:17:56 +02:00
build-wasm.sh Pin emsdk version to the same one used in Circle CI (#165) 2021-05-20 08:59:30 +03:00
CMakeLists.txt Import GetVersionFromFile cmake file in root level CMakeLists.txt 2021-05-17 19:34:58 +02:00
Doxyfile.in Marian compatible documentation tooling (#67) 2021-03-24 17:00:53 +00:00
LICENSE Initial commit 2020-10-19 13:49:38 +02:00
README.md Merge remote-tracking branch 'upstream/main' into main 2021-05-18 08:48:41 +02:00
run-clang-format.py Adding clang-format and updating existing sources to adhere (#151) 2021-05-19 21:50:21 +01:00

Bergamot Translator

CircleCI badge

Bergamot translator provides a unified API for (Marian NMT framework based) neural machine translation functionality in accordance with the Bergamot project that focuses on improving client-side machine translation in a web browser.

Build Instructions

Build Natively

Create a folder where you want to build all the artifacts (build-native in this case) and compile

mkdir build-native
cd build-native
cmake ../
make -j3

Build WASM

Prerequisite

Building on wasm requires Emscripten toolchain. It can be downloaded and installed using following instructions:

  • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
  • Enter the cloned directory: cd emsdk
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./emsdk_env.sh

Compile

  1. Create a folder where you want to build all the artifacts (build-wasm in this case) and compile

    mkdir build-wasm
    cd build-wasm
    emcmake cmake -DCOMPILE_WASM=on ../
    emmake make -j3
    

    The wasm artifacts (.js and .wasm files) will be available in the build directory ("build-wasm" in this case).

  2. Enable SIMD Wormhole via Wasm instantiation API in generated artifacts

    bash ../wasm/patch-artifacts-enable-wormhole.sh
    

Recompiling

As long as you don't update any submodule, just follow Compile steps.
If you update a submodule, execute following command in repository root folder before executing Compile steps.

git submodule update --init --recursive

How to use

Using Native version

The builds generate library that can be integrated to any project. All the public header files are specified in src folder.
A short example of how to use the APIs is provided in app/main.cpp file.

Using WASM version

Please follow the README inside the wasm folder of this repository that demonstrates how to use the translator in JavaScript.