bergamot-translator/doc/python.rst
Jerin Philip c0f311a8c0
Batteries included python package (#310)
Imports python bindings and associated sources incubated in
https://github.com/jerinphilip/lemonade to bergamot-translator. Adds
 a pybind11 dependency for python bindings.

Following the import, the python build is integrated into the existing 
CMake based build system here. There is a command-line application 
provided through python which provides the ability to fetch and prepare 
models from model-repositories (like browsermt/students or OPUS).

Wheels built for a few common operating systems are provided via GitHub
releases through automated actions configured to run at tagged semantic
versions and pushes to main.

The documentation for python is also integrated into our existing
documentation setup. Previous documentation GitHub action is now
configured to run behind python builds in Ubuntu 18.04 Python3.7,
in order to pick up the packaged as a wheel bergamot module and the
sphinx documentation using the python module.

Formatting checks of black, isort with profile black and a pytype type
checker is configured for the python component residing in this repository.
2022-01-26 20:33:43 +00:00

88 lines
1.9 KiB
ReStructuredText

.. Bergamot documentation master file, created by
sphinx-quickstart on Tue Jan 18 17:26:57 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Python
=======
.. toctree::
:maxdepth: 3
:caption: Contents:
This document describes python bindings from bergamot-translator and a
batteries included python package supplied for easy use. The library also
provides entry point via a command-line making it easier for the average user
to get started.
As bergamot-translator is built on top of marian, the python API should also
work as python bindings for marian trained models, if they need to be
integrated into python code-bases.
*Disclaimer*: The package is still in early stages and unstable. Functions and
classes might move around quite fast. Use at your own risk.
Command Line Interface
----------------------
.. argparse::
:ref: bergamot.cmds.make_parser
:prog: bergamot
Module Documentation
--------------------
.. automodule:: bergamot
:members:
:undoc-members:
bergamot-translator
+++++++++++++++++++
The following components are exported from C++ via python-bindings and form
library primitives that can be used to build translation workflows.
.. autoclass:: bergamot.ServiceConfig
:members:
:undoc-members:
.. autoclass:: bergamot.Service
:members:
:undoc-members:
.. autoclass:: bergamot.TranslationModel
:members:
:undoc-members:
.. autoclass:: bergamot.ResponseOptions
:members:
:undoc-members:
Model Inventory
+++++++++++++++
.. autoclass:: bergamot.repository.Repository
:members:
:undoc-members:
.. autoclass:: bergamot.repository.TranslateLocallyLike
:members:
:undoc-members:
Utilities
+++++++++
.. autofunction:: bergamot.utils.patch_marian_for_bergamot
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`