Skip to main content

Translates input between UK and US spelling

Project description

Local spelling

Developed by Fast Data Science, https://fastdatascience.com

Source code at https://github.com/fastdatascience/localspelling

Python library for localising spelling between British and American conventions, conserving case.

Please note this library converts only spelling variants such as US “honour” vs UK “honor”.

It does not localise vocabulary such as “pavement” vs “sidewalk” or “aubergine” vs “eggplant”.

It also does not localise spellings where there is more than one correct conversion, such as US “program”, which corresponds to both “programme” and “program” in British spelling.

Requirements

Python 3.6 and above

Installation

pip install localspelling

Usage examples

Example 1

from localspelling import convert_spelling
convert_spelling("it has been an honor", "gb")

outputs ‘it has been an honour’

Example 2: you can retrieve the dictionary used for the single words (this won’t match wildcards like ‘-isation’)

from localspelling import get_dictionary
get_dictionary("us")["honour"]

outputs ‘honor’

Who to contact

Thomas Wood at https://fastdatascience.com

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

localspelling-0.94.tar.gz (9.1 kB view hashes)

Uploaded Source

Supported by

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