{"id":13658072,"url":"https://github.com/pyurbans/urbans","last_synced_at":"2025-04-24T08:31:13.324Z","repository":{"id":40351900,"uuid":"289626655","full_name":"pyurbans/urbans","owner":"pyurbans","description":"A tool for translating text from source grammar to target grammar (context-free) with corresponding dictionary.","archived":false,"fork":false,"pushed_at":"2022-04-07T09:29:37.000Z","size":162,"stargazers_count":21,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T01:17:29.657Z","etag":null,"topics":["artificial-intelligence","data-science","machine-translation","nlp","python"],"latest_commit_sha":null,"homepage":"https://github.com/pyurbans/urbans","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyurbans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-23T06:05:06.000Z","updated_at":"2025-02-16T10:08:21.000Z","dependencies_parsed_at":"2022-08-09T18:00:20.063Z","dependency_job_id":null,"html_url":"https://github.com/pyurbans/urbans","commit_stats":null,"previous_names":["urbamt/urbamt","nlp-ruby/ruby"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyurbans%2Furbans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyurbans%2Furbans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyurbans%2Furbans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyurbans%2Furbans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyurbans","download_url":"https://codeload.github.com/pyurbans/urbans/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250591969,"owners_count":21455474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-intelligence","data-science","machine-translation","nlp","python"],"created_at":"2024-08-02T05:00:55.843Z","updated_at":"2025-04-24T08:31:11.862Z","avatar_url":"https://github.com/pyurbans.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# URBANS: Universal Rule-Based Machine Translation toolkit \n**A tool for translating text from source grammar to target grammar (context-free) with corresponding dictionary.**\n\n*Why not translate it yourself when Google Translate cannot satisfy you❓*\n\n[![CircleCI](https://circleci.com/gh/pyurbans/urbans/tree/master.svg?style=svg)](https://circleci.com/gh/pyurbans/urbans/tree/master)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/b4937f1f9fe0477b9fc557cbedf92b24)](https://www.codacy.com/gh/pyurbans/urbans?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=pyurbans/urbans\u0026amp;utm_campaign=Badge_Grade)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/b4937f1f9fe0477b9fc557cbedf92b24)](https://www.codacy.com/gh/pyurbans/urbans?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=pyurbans/urbans\u0026utm_campaign=Badge_Coverage)\n[![PyPI version](https://badge.fury.io/py/urbans.svg)](https://badge.fury.io/py/urbans)\n[![GitHub release](https://img.shields.io/github/release/pyurbans/urbans.svg)](https://GitHub.com/pyurbans/urbans/releases/)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/pyurbans/urbans/graphs/commit-activity)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/pyurbans/urbans/blob/master/LICENSE)\n\n\u003c/div\u003e\n\n## ⚙️ Installation\n```bash\npip install urbans\n```\n\n## ✨ What is good about urbans?\n- Rule-based, deterministic translation; unlike Google Translate - giving only 1 non-deterministic result\n- Using NLTK parsing interface and is built on top of already-efficient NLTK backend\n- Can be used for data augmentation\n\n## 📖 Usage\n```python\nfrom urbans import Translator\n\n# Source sentence to be translated\nsrc_sentences = [\"I love good dogs\", \"I hate bad dogs\"]\n\n# Source grammar in nltk parsing style\nsrc_grammar = \"\"\"\n                S -\u003e NP VP\n                NP -\u003e PRP\n                VP -\u003e VB NP\n                NP -\u003e JJ NN\n                PRP -\u003e 'I'\n                VB -\u003e 'love' | 'hate'\n                JJ -\u003e 'good' | 'bad'\n                NN -\u003e 'dogs'\n                \"\"\"\n\n# Some edit within source grammar to target grammar\nsrc_to_target_grammar =  {\n    \"NP -\u003e JJ NN\": \"NP -\u003e NN JJ\" # in Vietnamese NN goes before JJ\n}\n\n# Word-by-word dictionary from source language to target language\nen_to_vi_dict = {\n    \"I\":\"tôi\",\n    \"love\":\"yêu\",\n    \"hate\":\"ghét\",\n    \"dogs\":\"những chú_chó\",\n    \"good\":\"ngoan\",\n    \"bad\":\"hư\"\n    }\n\ntranslator = Translator(src_grammar = src_grammar,\n                        src_to_tgt_grammar = src_to_target_grammar,\n                        src_to_tgt_dictionary = en_to_vi_dict)\n\ntrans_sentences = translator.translate(src_sentences) \n# This should returns ['tôi yêu những chú_chó ngoan', 'tôi ghét những chú_chó hư']\n```\n\n## ⚖️ License\nThis repository is using the Apache 2.0 license that is listed in the repo. Please take a look at [`LICENSE`](https://github.com/pyurbans/urbans/blob/master/LICENSE) as you wish.\n\n## ✍️ BibTeX\nIf you wish to cite the framework feel free to use this (but only if you loved it 😊):\n```bibtex\n@misc{phat2020urbans,\n  author = {Truong-Phat Nguyen},\n  title = {URBANS: Universal Rule-Based Machine Translation NLP toolkit},\n  year = {2021},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/pyurbans/urbans}},\n}\n```\n\n## Contributors:\n- Patrick Phat Nguyen\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyurbans%2Furbans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyurbans%2Furbans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyurbans%2Furbans/lists"}