Skip to main content

A Pig Latin Translation Microservice

Project description

A flask-based microservice to translate english text to pig latin. Wikipedia Link.

Pig Latin is a language game in which words in English are altered. The objective is to conceal the words from others not familiar with the rules.

Pig Latin is simply a form of jargon with rules. The Rules are described later


You can try your own examples at a web form here.

Example Usage

The fastest way to get started is to request this service from the demo api


curl --request POST \
  --url \
  --form 'text=How do you say ... in Pig Latin?'


import requests
url = ""
payload = {"text": "How do you say ... in Pig Latin?"}
response = requests.request("POST", url, data=payload)
print response.text

You should see a response like

  "text": "Owhay oday ouyay aysay ... inyay Igpay Atinlay?"


If you would like to run the service locally, there are multiple ways


docker pull ja1chaudhary/pig-latin-translation-service
docker run --name pig-latin-service -p 5000:5000 -d ja1chaudhary/pig-latin-translation-service

Python Package

To install the python package, simply

pip install piglatintranslation
python -m piglatintranslation


git clone
cd pig-latin-translation-microservice
python install


If word begins with consonant sound, all letters before the initial vowel are placed at the end of the word sequence. Then, “ay” is added.

  • pig => igpay

  • banana => ananabay

  • trash => ashtray

  • happy => appyhay

  • duck => uckday

  • glove => oveglay

If word begins with vowel sounds or a silent letter, one just adds “yay” to the end.

  • eat => eatyay

  • omelet => omeletyay

  • are => areyay

Silent Letters

In order to infer silent letters cmu pronunication corpus of 134K words was used( The words with silent first letter were filtered into silent_words.json. Among them the most common prefixes were chosen as approximation of silent words. These include ( “pf”, “ph”, “ps”, “pn”, “pt”, “wr”, “ts”, “gn”, “kn”, “jo”, “he”)


API documentation is available at


To run test cases, simply do


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PigLatinTranslation-0.2.0.tar.gz (5.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page