Pre-release
This release is a pre-release and may not be stable for production use.
URBaMT: Universal Rule-Based Machine Translation toolkit
A tool for translating text from source grammar to target grammar (context-free) with corresponding dictionary.
Why not translate it yourself when Google Translate cannot satisfy you❓
Installation
pip install urbamt
Usage
from urbamt import Translator
# Source sentence to be translated
src_sentences = ["I love good dogs", "I hate bad dogs"]
# Source grammar in nltk parsing style
src_grammar = """
S -> NP VP
NP -> PRP
VP -> VB NP
NP -> JJ NN
PRP -> 'I'
VB -> 'love' | 'hate'
JJ -> 'good' | 'bad'
NN -> 'dogs'
"""
# Some edit within source grammar to target grammar
src_to_target_grammar = {
"NP -> JJ NN": "NP -> NN JJ" # in Vietnamese NN goes before JJ
}
# Word-by-word dictionary from source language to target language
en_to_vi_dict = {
"I":"tôi",
"love":"yêu",
"hate":"ghét",
"dogs":"những chú_chó",
"good":"ngoan",
"bad":"hư"
}
translator = Translator(src_grammar = src_grammar,
src_to_tgt_grammar = src_to_target_grammar,
src_to_tgt_dictionary = en_to_vi_dict)
trans_sentences = translator.translate(src_sentences)
# This should returns ['tôi yêu những chú_chó ngoan', 'tôi ghét những chú_chó hư']
License
This repository is using the Apache 2.0 license that is listed in the repo. Please take a look at LICENSE as you wish.
BibTeX
If you wish to cite the framework feel free to use this (but only if you loved it 😊):
@misc{phat2020urbamt,
author = {Patrick Phat},
title = {URBaMT: Universal Rule-Based Machine Translation toolkit},
year = {2020},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/urbamt/urbamt}},
}
Contributors:
- Patrick Phat Nguyen
Release files for urbamt 0.0.1b4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| urbamt-0.0.1b4.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| urbamt-0.0.1b4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.8 kB
Release files / urbamt-0.0.1b4.tar.gz
| Download URL | urbamt-0.0.1b4.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5678810745a8095f9b08442a47444ce479a51f7f7bfb6cacaacf00a1fbadaf30
|
|
BLAKE2b-256 checksum How to use checksums |
e5cc7f0c6a850de13823f97f664ee05b4b68c04bdf2f25249a6db7215b9b3eac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
|
Release files / urbamt-0.0.1b4-py3-none-any.whl
| Download URL | urbamt-0.0.1b4-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8eb5286e7ebf453ca1bbc3aeba9909bfb3b730e85c272e63d243690072a372e6
|
|
BLAKE2b-256 checksum How to use checksums |
5c3e53dab4e44eb8234a07e62d8a344df538124a83831667ac1c85e99ef47893
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
|