All Projects → pyurbans → urbans

pyurbans / urbans

Licence: Apache-2.0 license
A tool for translating text from source grammar to target grammar (context-free) with corresponding dictionary.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to urbans

Hardware Aware Transformers
[ACL 2020] HAT: Hardware-Aware Transformers for Efficient Natural Language Processing
Stars: ✭ 206 (+984.21%)
Mutual labels:  machine-translation
bergamot-translator
Cross platform C++ library focusing on optimized machine translation on the consumer-grade device.
Stars: ✭ 181 (+852.63%)
Mutual labels:  machine-translation
skt
Sanskrit compound segmentation using seq2seq model
Stars: ✭ 21 (+10.53%)
Mutual labels:  machine-translation
Modernmt
Neural Adaptive Machine Translation that adapts to context and learns from corrections.
Stars: ✭ 231 (+1115.79%)
Mutual labels:  machine-translation
sb-nmt
Code for Synchronous Bidirectional Neural Machine Translation (SB-NMT)
Stars: ✭ 66 (+247.37%)
Mutual labels:  machine-translation
OPUS-MT-train
Training open neural machine translation models
Stars: ✭ 166 (+773.68%)
Mutual labels:  machine-translation
Bleualign
Machine-Translation-based sentence alignment tool for parallel text
Stars: ✭ 199 (+947.37%)
Mutual labels:  machine-translation
SequenceToSequence
A seq2seq with attention dialogue/MT model implemented by TensorFlow.
Stars: ✭ 11 (-42.11%)
Mutual labels:  machine-translation
osdg-tool
OSDG is an open-source tool that maps and connects activities to the UN Sustainable Development Goals (SDGs) by identifying SDG-relevant content in any text. The tool is available online at www.osdg.ai. API access available for research purposes.
Stars: ✭ 22 (+15.79%)
Mutual labels:  machine-translation
tai5-uan5 gian5-gi2 kang1-ku7
臺灣言語工具
Stars: ✭ 79 (+315.79%)
Mutual labels:  machine-translation
ibleu
A visual and interactive scoring environment for machine translation systems.
Stars: ✭ 27 (+42.11%)
Mutual labels:  machine-translation
apertium-apy
📦 Apertium HTTP Server in Python
Stars: ✭ 29 (+52.63%)
Mutual labels:  machine-translation
extreme-adaptation-for-personalized-translation
Code for the paper "Extreme Adaptation for Personalized Neural Machine Translation"
Stars: ✭ 42 (+121.05%)
Mutual labels:  machine-translation
Opennmt
Open Source Neural Machine Translation in Torch (deprecated)
Stars: ✭ 2,339 (+12210.53%)
Mutual labels:  machine-translation
MetricMT
The official code repository for MetricMT - a reward optimization method for NMT with learned metrics
Stars: ✭ 23 (+21.05%)
Mutual labels:  machine-translation
Attention Mechanisms
Implementations for a family of attention mechanisms, suitable for all kinds of natural language processing tasks and compatible with TensorFlow 2.0 and Keras.
Stars: ✭ 203 (+968.42%)
Mutual labels:  machine-translation
tvsub
TVsub: DCU-Tencent Chinese-English Dialogue Corpus
Stars: ✭ 40 (+110.53%)
Mutual labels:  machine-translation
inmt
Interactive Neural Machine Translation tool
Stars: ✭ 44 (+131.58%)
Mutual labels:  machine-translation
rtg
Reader Translator Generator - NMT toolkit based on pytorch
Stars: ✭ 26 (+36.84%)
Mutual labels:  machine-translation
Distill-BERT-Textgen
Research code for ACL 2020 paper: "Distilling Knowledge Learned in BERT for Text Generation".
Stars: ✭ 121 (+536.84%)
Mutual labels:  machine-translation

URBANS: 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

CircleCI Codacy Badge Codacy Badge PyPI version GitHub release Maintenance License

⚙️ Installation

pip install urbans

What is good about urbans?

  • Rule-based, deterministic translation; unlike Google Translate - giving only 1 non-deterministic result
  • Using NLTK parsing interface and is built on top of already-efficient NLTK backend
  • Can be used for data augmentation

📖 Usage

from urbans 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{phat2020urbans,
  author = {Truong-Phat Nguyen},
  title = {URBANS: Universal Rule-Based Machine Translation NLP toolkit},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/pyurbans/urbans}},
}

Contributors:

  • Patrick Phat Nguyen
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].