Cross platform C++ library focusing on optimized machine translation on the consumer-grade device.
Go to file
2021-06-04 00:09:20 +01:00
.circleci Avoid packaging vocab files into wasm binary in CI builds 2021-05-12 09:55:49 +02:00
.github/workflows Deploy generated documentation only if browsermt (#179) 2021-06-01 11:00:53 +01:00
3rd_party Updating marian-dev: intgemm with env variable matmul switches (#187) 2021-06-03 21:01:26 +01:00
app Single executable (#175) 2021-05-31 14:44:59 +01:00
bergamot-translator-tests@020135af1b Single executable (#175) 2021-05-31 14:44:59 +01:00
cmake Added cmake file to compute version information 2021-05-17 19:34:58 +02:00
doc Including WASM documentation in sphinx build toc (#176) 2021-06-01 12:39:28 +01:00
scripts/ci Enabling ccache on github builds for Ubuntu (#95) 2021-05-17 11:42:47 +01:00
src Remove addSentenceWithPriority (#186) 2021-06-04 00:09:20 +01:00
wasm Including WASM documentation in sphinx build toc (#176) 2021-06-01 12:39:28 +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.