Skip to main content

nepali-roman

Package to convert Nepali text to romanized English.

Many a time, while working with data, either from government sector or from private sector, we encounter Nepali names of VDCs, municipalities, local level units, districts and places. While merging such data with another datasheet consisting names of units in English, we need to romanize the Nepali names to English before using some text similarity algorithms to do string matching.

This package helps in romanizing Nepali names using rudimentary script. It is worth mentioning that romanization of Nepali text used in our daily life is inconsistent. For example, the popular romanization of "नेपाल" is "Nepal". It might seem as the correct romanization but if we have to distinguish between "नेपाल" and "नेपल", we can't do that with this romanization scheme. So, this package uses unique and standard romanization scheme such that no two Nepali words have same romanization.

Installation

nepali-roman package is available for Python 3 and can be installed using pip.

First make sure pip is installed.

Then, the package can be installed using this command.

pip install nepali-roman

Usage

Import the nepali_roman module using the following command.

import nepali_roman as nr

The nepali_roman module has three functions: is_devanagari, romanize_text and romanize.

is_devanagari

This function checks if the text is in Devanagari format.

Detail description: In the text, it ignores all the punctuations, white spaces and other non-alphanumeric characters and then counts the number of devanagari characters. If the number of devanagari characters is more than or equal to 50% of the stripped text, the function deems the text devanagari, otherwise not.

Syntax:

>>> nr.is_devanagari(text)

Example:

>>> import nepali_roman as nr
>>> nr.is_devanagari("नगरपालिका")
    True

>>> nr.is_devanagari("surajपालिक")
    False

>>> nr.is_devanagari("suraj")
    False

romanize_text

This function can be used to romanize the Nepali text to English.

Syntax:

>>> nr.romanize_text(nepali_text)

Example:

>>> import nepali_roman as nr
>>> nr.romanize_text("नगरपालिका")
    nagarapaalikaa

romanize

This function takes Nepali text file as an input and saves the romanized text in specified output file.

Syntax:

>>> nr.romanize(input_file_path, output_file_path)

Example:

>>> import nepali_roman as nr
>>> nr.romanize('nepali.txt', 'romanized_english.txt')
# this takes Nepali text file nepali.txt and stores romanized English in the file romanized_english.txt

Contributions

The package is licenced with The MIT License (MIT) about which details can be found in the LICENSE file. As the package is open sourced and requires many improvements and extensions, any contributions are welcome. Any other feedback of any sort are highly welcome.

Metadata

Release files for nepali-roman 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nepali-roman 1.1
File Size Uploaded Provenance Actions
nepali_roman-1.1.tar.gz 4.9 kB Without provenance Details for nepali_roman-1.1.tar.gz

Release files / nepali_roman-1.1.tar.gz

Download URL nepali_roman-1.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b47289bda80063b3665cdcff260eb6e2f4aa3d6a009ad64e1212b19aebaaf41b
BLAKE2b-256 checksum
How to use checksums
c34aed8b323f0a671dac7e2436d5f73692e783c154d61898b91389d3474c6ee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9

Security for nepali-roman 1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page