Skip to main content

IPA-based phonetic distance: strict edit distance, listener-confusion distance, and per-phoneme acoustic and perceptual scoring.

Project description

phonetics

IPA-based phonetic distance for Python, built on a Rust core.

Install

pip install phonetics-ipa

The PyPI package is phonetics-ipa (the bare phonetics name is held by an unrelated metaphone library). The importable module is still phonetics:

import phonetics

Usage

import phonetics

# Strict per-phoneme acoustic distance, 0..1
phonetics.distance("p", "b")          # 0.15  (voicing flip)
phonetics.distance("ɑ", "ɔ")          # ~0.21 (acoustically distinct)

# Listener-confusion distance, Mad Gab calibrated
target = "ɪtsdʒʌstəstupɪdgeɪm"        # "It's just a stupid game"
clue   = "hɪtsdʒʌstɪsduphɪdkeɪm"      # "Hits Justice Dupe Hid Came"
phonetics.confusion(target, clue)     # ~0.77
phonetics.similarity(target, clue)    # ~0.96  (high listener overlap)

# Perceptual per-phoneme (with empirical confusion overlay)
phonetics.sub_cost("t", "ɾ")          # ~0.10 (American t-flapping)
phonetics.sub_cost("ɑ", "ɔ")          # ~0.05 (cot/caught merger, WCE)

# Tokenisation
phonetics.tokenize("kɑɪt")            # ['k', 'ɑɪ', 't']  (diphthong atomic)
phonetics.tokenize("it is", boundaries=True)  # ['i', 't', '#', 'i', 's']

See https://github.com/JackDanger/phonetics for the extended write-up of the metric design and the parity tests against Mad Gab puzzles.

License

MIT.

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

phonetics_ipa-0.2.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

phonetics_ipa-0.2.0-cp39-abi3-win_amd64.whl (123.4 kB view details)

Uploaded CPython 3.9+Windows x86-64

phonetics_ipa-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (262.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

phonetics_ipa-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (260.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

phonetics_ipa-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (224.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file phonetics_ipa-0.2.0.tar.gz.

File metadata

  • Download URL: phonetics_ipa-0.2.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for phonetics_ipa-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5785103f3fa5cbb8cf97537d9105a7fcdd937c09e98e3d6c3c10c099adea6303
MD5 8694497fb6e7db4d8d13af7656390c1a
BLAKE2b-256 0f5468158381daa6a908e555e1710e01621ccf0ca1d88c8cbf38efac597d6079

See more details on using hashes here.

Provenance

The following attestation bundles were made for phonetics_ipa-0.2.0.tar.gz:

Publisher: publish.yml on JackDanger/phonetics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file phonetics_ipa-0.2.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: phonetics_ipa-0.2.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 123.4 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for phonetics_ipa-0.2.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d2eb3eae976c9cc3b9c01a86f99e2fd4312d85c858c3ff47507e439d298152f0
MD5 2f3b81f8df4aee36840ccc302f053b26
BLAKE2b-256 03911c0033ef3a8e2f09ed70512258620575b747d3136104f219cd8d5bd57f13

See more details on using hashes here.

Provenance

The following attestation bundles were made for phonetics_ipa-0.2.0-cp39-abi3-win_amd64.whl:

Publisher: publish.yml on JackDanger/phonetics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file phonetics_ipa-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for phonetics_ipa-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e85c56d4f01ef3cc3a0a8dbf9a4464e66a51306bd4e6050fb9545ea71ed3117
MD5 4157058116f8ed07e7484efa069d37da
BLAKE2b-256 8b8069174ed5220cf4068623f119c17ee7bf85021f7456062c42225e61645ed1

See more details on using hashes here.

Provenance

The following attestation bundles were made for phonetics_ipa-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on JackDanger/phonetics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file phonetics_ipa-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for phonetics_ipa-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 81385d5d56561cf8e7c8654eaee90627542ea1b7230373fc4a7cbb7932749b63
MD5 0c582a4a7e27ea8d321982a05c31fabc
BLAKE2b-256 f4faaffb845608fa0745d0e20b8d0a87504b87fd61123ab39f2e60b7acc2f66a

See more details on using hashes here.

Provenance

The following attestation bundles were made for phonetics_ipa-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on JackDanger/phonetics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file phonetics_ipa-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for phonetics_ipa-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6b7790b8ecf8a0750a8f06f49623cd0d995cc1160d87a0adff1e91cb9570062b
MD5 900a8b148ae9cb325317cb16ff9e71ea
BLAKE2b-256 70b2bc554d26a8dfa95e6516deaf276ca43a4372b3c674b26a09fce37ed2c2d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for phonetics_ipa-0.2.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on JackDanger/phonetics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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