argostranslate


Nameargostranslate JSON
Version 1.9.6 PyPI version JSON
download
home_pagehttps://www.argosopentech.com
SummaryOpen-source neural machine translation library based on OpenNMT's CTranslate2
upload_time2024-04-30 21:32:44
maintainerNone
docs_urlNone
authorArgos Open Technologies, LLC
requires_python>=3.5
licenseNone
keywords
VCS
bugtrack_url
requirements ctranslate2 sentencepiece stanza packaging sacremoses
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Argos Translate
[Demo](https://libretranslate.com) | [Website](https://www.argosopentech.com) | [Docs](https://argos-translate.readthedocs.io) |  [Forum](https://community.libretranslate.com/c/argos-translate/5) | [GitHub](https://github.com/argosopentech/argos-translate) | [PyPI](https://pypi.org/project/argostranslate/)

**Open-source offline translation library written in Python**

Argos Translate uses [OpenNMT](https://opennmt.net/) for translations and can be used as either a Python library, command-line, or GUI application. Argos Translate supports installing language model packages which are zip archives with a ".argosmodel" extension containing the data needed for translation. [LibreTranslate](https://libretranslate.com) is an API and web-app built on top of Argos Translate.

Argos Translate also manages automatically pivoting through intermediate languages to translate between languages that don't have a direct translation between them installed. For example, if you have a es → en and en → fr translation installed you are able to translate from es → fr as if you had that translation installed. This allows for translating between a wide variety of languages at the cost of some loss of translation quality.

### Supported languages
Arabic, Azerbaijani, Catalan, Chinese, Czech, Danish, Dutch, English, Esperanto, Finnish, French, German, Greek, Hebrew, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Persian, Polish, Portuguese, Russian, Slovak, Spanish, Swedish, Turkish, Ukrainian, and more

[Request a language](https://github.com/argosopentech/argos-translate/discussions/91)

## Installation
### Install with Python
Argos Translate is available from [PyPI](https://pypi.org/project/argostranslate/) and can be easily installed or updated with [pip](https://pip.pypa.io/en/stable/installation/).

```
pip install argostranslate
```

Install [GUI](https://github.com/argosopentech/argos-translate-gui):
```
pip install argostranslategui
```

### Installation for macOS

1. Download the latest [macOS release.](https://github.com/argosopentech/argos-translate/releases/)
2. Extract the archive.
3. Copy the `.app` file to the Applications directory.

### Python source installation into virtualenv

Download a copy of this repo and install with pip.

```
git clone https://github.com/argosopentech/argos-translate.git
cd argos-translate
virtualenv env
source env/bin/activate
pip install -e .
```

## Examples
### [Python](https://argos-translate.readthedocs.io/en/latest/py-modindex.html)

```python
import argostranslate.package
import argostranslate.translate

from_code = "en"
to_code = "es"

# Download and install Argos Translate package
argostranslate.package.update_package_index()
available_packages = argostranslate.package.get_available_packages()
package_to_install = next(
    filter(
        lambda x: x.from_code == from_code and x.to_code == to_code, available_packages
    )
)
argostranslate.package.install_from_path(package_to_install.download())

# Translate
translatedText = argostranslate.translate.translate("Hello World", from_code, to_code)
print(translatedText)
# '¡Hola Mundo!'
```

### Command Line Interface
```
argospm update
argospm install translate-en_de
argos-translate --from en --to de "Hello World!"
# Hallo Welt!

```

Install all translation packages:
```
argospm install translate
```

### [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) Web App ([Demo](https://libretranslate.com/))
![Web App Screenshot](img/WebAppScreenshot.png)

### [LibreTranslate](https://github.com/uav4geo/LibreTranslate) API

```javascript
const res = await fetch("https://translate.argosopentech.com/translate", {
	method: "POST",
	body: JSON.stringify({
		q: "Hello!",
		source: "en",
		target: "es"
	}),
	headers: {
		"Content-Type": "application/json"}
	});

console.log(await res.json());

{
    "translatedText": "¡Hola!"
}
```

#### Graphical user interface
The GUI code is in a [separate repository](https://github.com/argosopentech/argos-translate-gui).

![Screenshot](/img/Screenshot.png)
![Screenshot2](/img/Screenshot2.png)
![Argos Translate macOS Screenshot](/img/ArgosTranslateMacOSScreenshot.png)


## [Packages](https://www.argosopentech.com/argospm/index/)
- [Browse](https://www.argosopentech.com/argospm/index/)
- [P2P download (IPFS and BitTorrent)](/p2p/README.md)
- [Training scripts](https://github.com/argosopentech/argos-train)
- [Google Drive download](https://drive.google.com/drive/folders/11wxM3Ze7NCgOk_tdtRjwet10DmtvFu3i)


### GPU Acceleration

To enable GPU support, you need to set the `ARGOS_DEVICE_TYPE` env variable to `cuda` or `auto`.

```
$ ARGOS_DEVICE_TYPE=cuda argos-translate --from-lang en --to-lang es "Hello World"
Hola Mundo
```

The above env variable passes the device type to [CTranslate2](https://github.com/OpenNMT/CTranslate2).

### HTML Translation
The [translate-html](https://github.com/argosopentech/translate-html) library is built on top of Argos Translate and [Beautiful Soup](https://beautiful-soup-4.readthedocs.io/en/latest/) and parses and translates HTML. The LibreTranslate API also has support for translating HTML.


### Files Translation
The [argos-translate-files](https://github.com/LibreTranslate/argos-translate-files) library is built on top of Argos Translate and parses and translates files. The LibreTranslate API also has support for translating files.

## Uninstall

``` shell
pip uninstall argostranslate
```

You may choose to also delete temporary and cached files:

``` shell
rm -r ~/.local/cache/argos-translate
rm -r ~/.local/share/argos-translate
```

## Related Projects
- [LibreTranslate-py](https://github.com/argosopentech/LibreTranslate-py) - Python bindings for LibreTranslate
- [MetalTranslate](https://github.com/argosopentech/MetalTranslate) - Customizable translation in C++
- [LibreTranslate/Locomotive](https://github.com/LibreTranslate/Locomotive) - Toolkit for training/converting LibreTranslate compatible language models 🚂 
- [DesktopTranslator](https://github.com/ymoslem/DesktopTranslator) - [OpenNMT](https://opennmt.net/) based translation application
- [LibreTranslate-rs](https://github.com/grantshandy/libretranslate-rs) - LibreTranslate Rust bindings
- [LibreTranslate Go](https://github.com/SnakeSel/libretranslate) - LibreTranslate Golang bindings
- [LibreTranslator](https://gitlab.com/BeowuIf/libretranslator) - LibreTranslate Android app
- [LiTranslate](https://community.libretranslate.com/t/litranslate-ios-app/333) - iOS LibreTranslate client

## Contributing
Contributions are welcome! Available issues are on the [GitHub issues page](https://github.com/argosopentech/argos-translate/issues). Contributions of code, data, and pre-trained models can all be accepted.

## Support
For support please use the [LibreTranslate Forum](https://community.libretranslate.com/c/argos-translate/5) or [GitHub Issues](https://github.com/argosopentech/argos-translate/issues).

For questions about [CTranslate2](https://github.com/OpenNMT/CTranslate2) or general machine translation research the [OpenNMT Forum](https://forum.opennmt.net/) is a good resource.

## Services
Custom models trained on your own data are available for $1000/language (negotiable).

[I am also available for hire](https://www.argosopentech.com/about/) to do support, consulting, or custom software development.

## Donate
If you find this software useful donations are greatly appreciated and help to make this project sustainable.
- [GitHub Sponsor](https://github.com/sponsors/argosopentech)
- [PayPal](https://www.paypal.com/biz/fund?id=MCCFG437JP9PJ)
- Bitcoin: 16UJrmSEGojFPaqjTGpuSMNhNRSsnspFJT
- Ethereum: argosopentech.eth
- Litecoin: MCwu7RRWeCRJdsv2bXGj2nnL1xYxDBvwW5
- BCH: bitcoincash:qzvpxe8y5kq45kahqkyv3p88sjrhlymj2v6xdrj3cv

Paid supporters receive priority support.

#### Hosting affiliate links
You can help support Argos Translate financially by purchasing hosting through these referral links:
- [Vast.ai](http://vast.ai/?ref=24817) - Cheap GPU rentals
- [DigitalOcean](https://m.do.co/c/a1af57be6e3f) - Best all around hosting
- [Sharktech](https://portal.sharktech.net/aff.php?aff=1181) - Cheap bandwith
- [Time4VPS](https://www.time4vps.com/?affid=6929) - Cheap storage

#### Argos Translate 2 beta
A beta version of Argos Translate 2 is available to install from source from the [v2 branch on GitHub](https://github.com/argosopentech/argos-translate/tree/v2). Argos Translate 2 has a [multilingual model architecture](https://community.libretranslate.com/t/multilingual-translation-with-ctranslate2-and-pre-trained-fairseq-models/178/), more extensive unit testing, and a more experimental orientation.

## Contributing
Contributions are welcome! Bug reports, pull requests, documentation writing, and feature ideas are all appreciated.

## License
Argos Translate is dual licensed under either the [MIT License](https://github.com/argosopentech/argos-translate/blob/master/LICENSE) or [Creative Commons CC0](https://creativecommons.org/share-your-work/public-domain/cc0/).



            

Raw data

            {
    "_id": null,
    "home_page": "https://www.argosopentech.com",
    "name": "argostranslate",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": null,
    "author": "Argos Open Technologies, LLC",
    "author_email": "admin@argosopentech.com",
    "download_url": "https://files.pythonhosted.org/packages/6b/fc/13aa57857bee34f62cb9018c5fd4ec56da714431689b62cca9dce30a8877/argostranslate-1.9.6.tar.gz",
    "platform": null,
    "description": "# Argos Translate\n[Demo](https://libretranslate.com) | [Website](https://www.argosopentech.com) | [Docs](https://argos-translate.readthedocs.io) |  [Forum](https://community.libretranslate.com/c/argos-translate/5) | [GitHub](https://github.com/argosopentech/argos-translate) | [PyPI](https://pypi.org/project/argostranslate/)\n\n**Open-source offline translation library written in Python**\n\nArgos Translate uses [OpenNMT](https://opennmt.net/) for translations and can be used as either a Python library, command-line, or GUI application. Argos Translate supports installing language model packages which are zip archives with a \".argosmodel\" extension containing the data needed for translation. [LibreTranslate](https://libretranslate.com) is an API and web-app built on top of Argos Translate.\n\nArgos Translate also manages automatically pivoting through intermediate languages to translate between languages that don't have a direct translation between them installed. For example, if you have a es \u2192 en and en \u2192 fr translation installed you are able to translate from es \u2192 fr as if you had that translation installed. This allows for translating between a wide variety of languages at the cost of some loss of translation quality.\n\n### Supported languages\nArabic, Azerbaijani, Catalan, Chinese, Czech, Danish, Dutch, English, Esperanto, Finnish, French, German, Greek, Hebrew, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Persian, Polish, Portuguese, Russian, Slovak, Spanish, Swedish, Turkish, Ukrainian, and more\n\n[Request a language](https://github.com/argosopentech/argos-translate/discussions/91)\n\n## Installation\n### Install with Python\nArgos Translate is available from [PyPI](https://pypi.org/project/argostranslate/) and can be easily installed or updated with [pip](https://pip.pypa.io/en/stable/installation/).\n\n```\npip install argostranslate\n```\n\nInstall [GUI](https://github.com/argosopentech/argos-translate-gui):\n```\npip install argostranslategui\n```\n\n### Installation for macOS\n\n1. Download the latest [macOS release.](https://github.com/argosopentech/argos-translate/releases/)\n2. Extract the archive.\n3. Copy the `.app` file to the Applications directory.\n\n### Python source installation into virtualenv\n\nDownload a copy of this repo and install with pip.\n\n```\ngit clone https://github.com/argosopentech/argos-translate.git\ncd argos-translate\nvirtualenv env\nsource env/bin/activate\npip install -e .\n```\n\n## Examples\n### [Python](https://argos-translate.readthedocs.io/en/latest/py-modindex.html)\n\n```python\nimport argostranslate.package\nimport argostranslate.translate\n\nfrom_code = \"en\"\nto_code = \"es\"\n\n# Download and install Argos Translate package\nargostranslate.package.update_package_index()\navailable_packages = argostranslate.package.get_available_packages()\npackage_to_install = next(\n    filter(\n        lambda x: x.from_code == from_code and x.to_code == to_code, available_packages\n    )\n)\nargostranslate.package.install_from_path(package_to_install.download())\n\n# Translate\ntranslatedText = argostranslate.translate.translate(\"Hello World\", from_code, to_code)\nprint(translatedText)\n# '\u00a1Hola Mundo!'\n```\n\n### Command Line Interface\n```\nargospm update\nargospm install translate-en_de\nargos-translate --from en --to de \"Hello World!\"\n# Hallo Welt!\n\n```\n\nInstall all translation packages:\n```\nargospm install translate\n```\n\n### [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) Web App ([Demo](https://libretranslate.com/))\n![Web App Screenshot](img/WebAppScreenshot.png)\n\n### [LibreTranslate](https://github.com/uav4geo/LibreTranslate) API\n\n```javascript\nconst res = await fetch(\"https://translate.argosopentech.com/translate\", {\n\tmethod: \"POST\",\n\tbody: JSON.stringify({\n\t\tq: \"Hello!\",\n\t\tsource: \"en\",\n\t\ttarget: \"es\"\n\t}),\n\theaders: {\n\t\t\"Content-Type\": \"application/json\"}\n\t});\n\nconsole.log(await res.json());\n\n{\n    \"translatedText\": \"\u00a1Hola!\"\n}\n```\n\n#### Graphical user interface\nThe GUI code is in a [separate repository](https://github.com/argosopentech/argos-translate-gui).\n\n![Screenshot](/img/Screenshot.png)\n![Screenshot2](/img/Screenshot2.png)\n![Argos Translate macOS Screenshot](/img/ArgosTranslateMacOSScreenshot.png)\n\n\n## [Packages](https://www.argosopentech.com/argospm/index/)\n- [Browse](https://www.argosopentech.com/argospm/index/)\n- [P2P download (IPFS and BitTorrent)](/p2p/README.md)\n- [Training scripts](https://github.com/argosopentech/argos-train)\n- [Google Drive download](https://drive.google.com/drive/folders/11wxM3Ze7NCgOk_tdtRjwet10DmtvFu3i)\n\n\n### GPU Acceleration\n\nTo enable GPU support, you need to set the `ARGOS_DEVICE_TYPE` env variable to `cuda` or `auto`.\n\n```\n$ ARGOS_DEVICE_TYPE=cuda argos-translate --from-lang en --to-lang es \"Hello World\"\nHola Mundo\n```\n\nThe above env variable passes the device type to [CTranslate2](https://github.com/OpenNMT/CTranslate2).\n\n### HTML Translation\nThe [translate-html](https://github.com/argosopentech/translate-html) library is built on top of Argos Translate and [Beautiful Soup](https://beautiful-soup-4.readthedocs.io/en/latest/) and parses and translates HTML. The LibreTranslate API also has support for translating HTML.\n\n\n### Files Translation\nThe [argos-translate-files](https://github.com/LibreTranslate/argos-translate-files) library is built on top of Argos Translate and parses and translates files. The LibreTranslate API also has support for translating files.\n\n## Uninstall\n\n``` shell\npip uninstall argostranslate\n```\n\nYou may choose to also delete temporary and cached files:\n\n``` shell\nrm -r ~/.local/cache/argos-translate\nrm -r ~/.local/share/argos-translate\n```\n\n## Related Projects\n- [LibreTranslate-py](https://github.com/argosopentech/LibreTranslate-py) - Python bindings for LibreTranslate\n- [MetalTranslate](https://github.com/argosopentech/MetalTranslate) - Customizable translation in C++\n- [LibreTranslate/Locomotive](https://github.com/LibreTranslate/Locomotive) - Toolkit for training/converting LibreTranslate compatible language models \ud83d\ude82 \n- [DesktopTranslator](https://github.com/ymoslem/DesktopTranslator) - [OpenNMT](https://opennmt.net/) based translation application\n- [LibreTranslate-rs](https://github.com/grantshandy/libretranslate-rs) - LibreTranslate Rust bindings\n- [LibreTranslate Go](https://github.com/SnakeSel/libretranslate) - LibreTranslate Golang bindings\n- [LibreTranslator](https://gitlab.com/BeowuIf/libretranslator) - LibreTranslate Android app\n- [LiTranslate](https://community.libretranslate.com/t/litranslate-ios-app/333) - iOS LibreTranslate client\n\n## Contributing\nContributions are welcome! Available issues are on the [GitHub issues page](https://github.com/argosopentech/argos-translate/issues). Contributions of code, data, and pre-trained models can all be accepted.\n\n## Support\nFor support please use the [LibreTranslate Forum](https://community.libretranslate.com/c/argos-translate/5) or [GitHub Issues](https://github.com/argosopentech/argos-translate/issues).\n\nFor questions about [CTranslate2](https://github.com/OpenNMT/CTranslate2) or general machine translation research the [OpenNMT Forum](https://forum.opennmt.net/) is a good resource.\n\n## Services\nCustom models trained on your own data are available for $1000/language (negotiable).\n\n[I am also available for hire](https://www.argosopentech.com/about/) to do support, consulting, or custom software development.\n\n## Donate\nIf you find this software useful donations are greatly appreciated and help to make this project sustainable.\n- [GitHub Sponsor](https://github.com/sponsors/argosopentech)\n- [PayPal](https://www.paypal.com/biz/fund?id=MCCFG437JP9PJ)\n- Bitcoin: 16UJrmSEGojFPaqjTGpuSMNhNRSsnspFJT\n- Ethereum: argosopentech.eth\n- Litecoin: MCwu7RRWeCRJdsv2bXGj2nnL1xYxDBvwW5\n- BCH: bitcoincash:qzvpxe8y5kq45kahqkyv3p88sjrhlymj2v6xdrj3cv\n\nPaid supporters receive priority support.\n\n#### Hosting affiliate links\nYou can help support Argos Translate financially by purchasing hosting through these referral links:\n- [Vast.ai](http://vast.ai/?ref=24817) - Cheap GPU rentals\n- [DigitalOcean](https://m.do.co/c/a1af57be6e3f) - Best all around hosting\n- [Sharktech](https://portal.sharktech.net/aff.php?aff=1181) - Cheap bandwith\n- [Time4VPS](https://www.time4vps.com/?affid=6929) - Cheap storage\n\n#### Argos Translate 2 beta\nA beta version of Argos Translate 2 is available to install from source from the [v2 branch on GitHub](https://github.com/argosopentech/argos-translate/tree/v2). Argos Translate 2 has a [multilingual model architecture](https://community.libretranslate.com/t/multilingual-translation-with-ctranslate2-and-pre-trained-fairseq-models/178/), more extensive unit testing, and a more experimental orientation.\n\n## Contributing\nContributions are welcome! Bug reports, pull requests, documentation writing, and feature ideas are all appreciated.\n\n## License\nArgos Translate is dual licensed under either the [MIT License](https://github.com/argosopentech/argos-translate/blob/master/LICENSE) or [Creative Commons CC0](https://creativecommons.org/share-your-work/public-domain/cc0/).\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Open-source neural machine translation library based on OpenNMT's CTranslate2",
    "version": "1.9.6",
    "project_urls": {
        "Documentation": "https://argos-translate.readthedocs.io/en/latest/",
        "Forum": "https://community.libretranslate.com/c/argos-translate/5",
        "GitHub": "https://github.com/argosopentech/argos-translate",
        "Homepage": "https://www.argosopentech.com",
        "Website": "https://www.argosopentech.com"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "01f9b472322ea3de4752bbec7fb2f169f057872390a9ff35f72a2142d06392ae",
                "md5": "ce5d78f1b90fd1e3636698177d0407cb",
                "sha256": "285b194bd64d65617ee2fa8969a40ce790c6b3acf875f94f1d2b0373f3ae691c"
            },
            "downloads": -1,
            "filename": "argostranslate-1.9.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ce5d78f1b90fd1e3636698177d0407cb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 34360,
            "upload_time": "2024-04-30T21:32:41",
            "upload_time_iso_8601": "2024-04-30T21:32:41.723513Z",
            "url": "https://files.pythonhosted.org/packages/01/f9/b472322ea3de4752bbec7fb2f169f057872390a9ff35f72a2142d06392ae/argostranslate-1.9.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6bfc13aa57857bee34f62cb9018c5fd4ec56da714431689b62cca9dce30a8877",
                "md5": "1bdf1afe646b6d3f6b494a64c63ec0a6",
                "sha256": "dd8cc1327aa67132299f950e160dd20d314b8cf484f540f0d22f1f07c2d8876b"
            },
            "downloads": -1,
            "filename": "argostranslate-1.9.6.tar.gz",
            "has_sig": false,
            "md5_digest": "1bdf1afe646b6d3f6b494a64c63ec0a6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 32855,
            "upload_time": "2024-04-30T21:32:44",
            "upload_time_iso_8601": "2024-04-30T21:32:44.150158Z",
            "url": "https://files.pythonhosted.org/packages/6b/fc/13aa57857bee34f62cb9018c5fd4ec56da714431689b62cca9dce30a8877/argostranslate-1.9.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 21:32:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "argosopentech",
    "github_project": "argos-translate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "ctranslate2",
            "specs": [
                [
                    "<",
                    "5"
                ],
                [
                    ">=",
                    "4.0"
                ]
            ]
        },
        {
            "name": "sentencepiece",
            "specs": [
                [
                    "==",
                    "0.2.0"
                ]
            ]
        },
        {
            "name": "stanza",
            "specs": [
                [
                    "==",
                    "1.1.1"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": []
        },
        {
            "name": "sacremoses",
            "specs": [
                [
                    "==",
                    "0.0.53"
                ]
            ]
        }
    ],
    "lcname": "argostranslate"
}
        
Elapsed time: 0.24026s