This repository contains a python package to perform english to pig latin translations based on the rules below.
The install below will create an executable and you can then start the server locally.
git clone https://github.com/steve-federowicz/piglatin.git
pip install ./piglatin
piglatin 'Hello, World!'
from piglatin import translator
translator.translate_phrase('Hello, World!')
Optionally, you can run the flask server via the following commands and then access the web UI locally at localhost:5000
export FLASK_APP=$(pwd)/piglatin/piglatin/server.py
flask run
-
General rule: take the first letter of a word, move it to the end, and add "ay". Example: "hello" becomes "ellohay".
-
A phrase with multiple words should translate each word: "hello world" becomes "ellohay orldway"
-
A word which begins with a vowel keeps its first letter, and just adds "way" to the end of the word: "eat apples" becomes "eatway applesway"
-
A word which is capitalized should remain capitalized after translation: "Hello world" becomes "Ellohay orldway"
-
A phrase with punctuation should maintain the position of the punctuation: "Hello, world!" becomes "Ellohay, orldway!"
-
A word beginning with multiple consonants should move all of them together to the end: "drunk strangers" becomes "unkdray angersstray"
-
The letters "qu" should stay together when moved to the end of a word: "quickly and quietly" becomes "icklyquay andway ietlyquay"