Library of Congress script transliterator.

Stefano Cossu ba86a594a7 API documentation; TODO list; raise 400 for internal exceptions. 1 yıl önce
data ec33242346 Basic REST API. 1 yıl önce
transliterator ba86a594a7 API documentation; TODO list; raise 400 for internal exceptions. 1 yıl önce
.gitignore 45beb9b314 Ignore .bas files. 1 yıl önce
Dockerfile acf4bf7b3d Flask and Docker boilerplate. 1 yıl önce
LICENSE 20cb85dad1 Initial commit 1 yıl önce
NOTES.md 70cad517c7 Add some answers to questions in the notes. 1 yıl önce
README.md ba86a594a7 API documentation; TODO list; raise 400 for internal exceptions. 1 yıl önce
TODO.md ba86a594a7 API documentation; TODO list; raise 400 for internal exceptions. 1 yıl önce
entrypoint.sh acf4bf7b3d Flask and Docker boilerplate. 1 yıl önce
requirements.txt acf4bf7b3d Flask and Docker boilerplate. 1 yıl önce
uwsgi.ini acf4bf7b3d Flask and Docker boilerplate. 1 yıl önce
wsgi.py acf4bf7b3d Flask and Docker boilerplate. 1 yıl önce

README.md

transliterator

REST API service to convert non-Latin scripts to Latin, and vice versa.

Run on Docker

Build container in current dir:

docker build -t transliterator:latest .

Start container:

docker run -e TXL_FLASK_SECRET=changeme -p 8000:8000 transliterator:latest

Web UI

/ renders a simple HTML form to test the transliteration service.

REST API

GET /health

Useful endpoint for health checks.

Response code

200 OK if the service is running.

GET /languages

List all the languages supported.

Response code

200 OK

Response body

MIME type: application/json

Content: a JSON object of the supported language tables. Keys are the keywords used throughout the API, e.g. for /transliterate. Each key is paired with an object that contains some basic metadata about the language features. At the moment, only the human-readable name is available.

GET /table/<lang>

Dump a language table.

URI parameters

  • <lang>: Language code as given by the /languages endpoint.

Response code

200 OK

Response body

MIME type: application/json

Content: language configuration as a JSON object with all the transliteration rules as they are read by the application. If the table inherits from a parent, the computed values from the merged tables are shown.

POST /transliterate/<lang>[/r2s]

Transliterate an input string in a given language.

URI parameters

  • <lang>: Language code as given by the /languages endpoint.
  • r2s: if appended to the URI, the transliteration is intended to be Roman-to-script, and the input string should be Latin text. If not, the default behavior is followed, which is interpreting the input as a script in the given language, and returning the Romanized text.

POST body

  • text: Input text to be transliterated.

Response code

  • 200 OK on successful operation.
  • 400 Bad Request for an invalid request. The reason for the failure is normally printed in the response body.

Response body

MIME Type: text/plain

Content: transliterated string. Characters not found in the mapping are copied verbatim (see "Configuration files" section for more information).

Configuration files

TODO