Skip to main content

Malayalam phonetic analyser

Project description

PyPI Version

This is python interface for the Malayalam phonetic analyser - mlphon.

Installation

Python 3 is required. Using with venv is recommended

$ pip install mlphon

Usage

Grapheme to Phoneme analysis example

from mlphon import G2P
analyser = G2P()
analyser.analyse('കേരളം')

Gives

[(('<BoS>k<plosive><voiceless><unaspirated><velar>eː<v_sign><EoS><BoS>ɾ<flapped><alveolar>a<schwa><EoS><BoS>ɭ<lateral><retroflex>a<schwa>m<anuswara><EoS>', 0.0),))]

The second item in this result is the weight. It is not relevant in the current implementation.

Grapheme to Phoneme generation example

from mlphon import G2P
generator = G2P()
generator.generate('<BoS>k<plosive><voiceless><unaspirated><velar>eː<v_sign><EoS><BoS>ɾ<flapped><alveolar>a<schwa><EoS><BoS>ɭ<lateral><retroflex>a<schwa>m<anuswara><EoS>')

Gives

(('കേരളം', 0.0),)

The second item in this result is the weight. It is not relevant in the current implementation.

Grapheme to IPA analysis

from mlphon import IPA
analyser = IPA()
analyser.analyse("കേരളം")

Gives

(('keːɾaɭam<anuswara>', 0.0),)

<anauswara>, <visarga>, <chillu> tags are explisitly shown in the IPA analysis.

Grapheme generation from IPA

from mlphon import IPA
generator = IPA()
generator.generate('keːɾaɭam<anuswara>')

Gives

(('കേരളം', 0.0),)

There can be multiple results in this generation. Please ignore the irrelevant ones, if any.

Syllablizer

from mlphon import Syllablizer
syl = Syllablizer()
syl.syllablize('കേരളം')

Gives

(('<BoS>കേ<EoS><BoS>ര<EoS><BoS>ളം<EoS>', 0.0),)

Command line interface

G2P

$ mlg2p --help
  usage: mlg2p [-h] [-i INFILE] [-o OUTFILE] [-a] [-g] [-v]
  optional arguments:
  -h, --help            show this help message and exit
  -i INFILE, --input INFILE
                    source of analysis data
  -o OUTFILE, --output OUTFILE
                    target of generated strings
  -a, --analyse         Analyse the input file strings
  -g, --generate        Generate the input file strings
  -v, --verbose         print verbosely while processing

IPA

$ mlipa --help
  usage: mlipa [-h] [-i INFILE] [-o OUTFILE] [-a] [-g] [-v]
  optional arguments:
  -h, --help            show this help message and exit
  -i INFILE, --input INFILE
                    source of analysis data
  -o OUTFILE, --output OUTFILE
                    target of generated strings
  -a, --analyse         Analyse the input file strings
  -g, --generate        Generate the input file strings
  -v, --verbose         print verbosely while processing

Syllablizer

$ mlsyllablize --help
  usage: mlsyllablize [-h] [-i INFILE] [-o OUTFILE]
  optional arguments:
  -h, --help            show this help message and exit
  -i INFILE, --input INFILE
                    source of analysis data
  -o OUTFILE, --output OUTFILE
                    target of generated strings

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

mlphon-1.0.4.tar.gz (9.6 kB view details)

Uploaded Source

File details

Details for the file mlphon-1.0.4.tar.gz.

File metadata

  • Download URL: mlphon-1.0.4.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2rc1

File hashes

Hashes for mlphon-1.0.4.tar.gz
Algorithm Hash digest
SHA256 83216e4a69c6f99b9f1d1eaa2d7b51074dc8bf2d17d57ab88866b267ad2b89c4
MD5 0a3a01b919a75968954e9a4142a85ce5
BLAKE2b-256 091f1880ce911860067ea8b2008defc8e01a96a141b980b2cc200ff1d8eb7dfd

See more details on using hashes here.

Supported by

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