Skip to main content

ipapy is a Python module to work with IPA strings.

Installation

$ pip install ipapy

or

$ git clone https://github.com/pettarin/ipapy.git
$ cd ipapy

Usage

from ipapy.ipastring import IPAString
from ipapy.ipachar import IPADiacritic

# Unicode string for "Italian style"
s = u"iˈtaljans ˈtail"

# check if s contains only IPA characters (yes)
if IPAString.is_valid_ipa(s):
    print("s is a valid IPA string")

# create IPA string from Unicode string
s_ipa = IPAString(unicode_string=s)

# print the IPAString
print(unicode(s_ipa))   # Python 2
print(s_ipa)            # Python 3

# print the IPAString (Python 3)
print(s_ipa)

# new IPAStrings containing only...
s_cv = s.cns_vwl                # vowels and consonants
s_cvs = s.cns_vwl_str           # + stress marks
s_cvsl = s.cns_vwl_str_len      # + lenght marks
s_cvslw = s.cns_vwl_str_len_wb  # + word breaks

# iterate over each IPA char, print it, and,
# if it is a diacritic, print its properties
for c_ipa in s_ipa:
    print(c_ipa)
    if isinstance(c_ipa, IPADiacritic):
        print(c_ipa.properties)

# print the name and properties of all the vowels in the string
for c_ipa in [c for c in s_ipa if c.is_vowel]:
    print(u"%s => %s" % (c_ipa, c_ipa.name))

# print the name and properties of all the consonants in the string
for c_ipa in [c for c in s_ipa if c.is_consonant]:
    print(u"%s => %s" % (c_ipa, c_ipa.name))

License

ipapy is released under the MIT License.

Release files for ipapy 0.0.1.0

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

Source distribution (sdist)

Source distribution for ipapy 0.0.1.0
File Size Uploaded
ipapy-0.0.1.0.tar.gz 32.4 kB Details

Release files / ipapy-0.0.1.0.tar.gz

Download URL ipapy-0.0.1.0.tar.gz
Size 32.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fdb7f47be21f99a31767c7c02b5666442b492e2c145c29d642a5f822d864f6ca
BLAKE2b-256 checksum
How to use checksums
fc452851945ee8f9c86b16c5be1bc12375d6f3c8a4607baec00e75bf096c5615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.0.6.0

1 release file

0.0.5.0

1 release file

0.0.4.0

1 release file

0.0.3.0

1 release file

0.0.2.0

1 release file

0.0.1.1

1 release file

This release

0.0.1.0 This release

1 release file

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