npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tmcw/ipa-parser

v1.0.2-alpha.0

Published

A parser for International Phonetic Alphabet (IPA)

Downloads

8

Readme

Internationl Phonetic Alphabet Parser

A parser for International Phonetic Alphabet (IPA) string as described in IPA chart.

Return a list of semantic units either segmental (vowel or consonant) or suprasegmental (tone, prosody, ...). These semantic units are simply called hereafter unit.

Install and Use

npm install ipa-parser --save
const parser = require("ipa-parser").parser;
let result = parser.parse("/hɛˈləʊ/");

Result format :

{
  'type': string // the transcription type
  'units': [] // an array of IPA unit 
}

Transcription type

IPA can be used for phonetic and phonemic transcription. The context is indicated by bracket around the sequence. This indication is optional. If define, fisrt and last character should match. Transcription type can be phonetic, phonemic, prosodic, indistinguishable, obscured or none if not define.

|input| type | |:---:| ------ | |a |none | |[a]|phonetic| |/a/|phonemic| |(a)|indistinguishable| |⸨a⸩|obscured| |{a}|prosodic|

Nota : (( and )) are not accepted, and should be used

IPA units

The parser return a list of "IPA-unit". These units can be either "segment" or "supra-segmental". Segment represent the finest sound decomposition and can be either vowel or consonant. Supra-segmental represent information applying on more than one segment like tone or prosody.

Unit properties :

| name | type | | | --- | --- | --- | | segment |boolean|true if the unit is a segment, false if supra-segmental| | category |string | (see Category below) |

List of Category for unit :

|category |segmental|description| | --- | --- | --- | |vowel | true | /1 | |consonant | true | /2 | |tone | false | /3 | |tone-step | false | /4 | |intonation| false | /4 | |stress | false | /4 | |separator | false | /4 |

Nota : Quantity (also called length) information is not a separate unit but contain in segmental unit (vowel or consonnat)

Segment : Vowel and Consonant

Vowel and consonant have common properties :

| name | type | | | --- | --- | --- | |quantity| String | extra-short, short, half-long, long or extra-long | |syllabic| boolean | | |voicing | object | see below | |nasal | boolean | |

Vowel specifics properties :

| name | type | | | --- | --- | --- | |height | number | -3 (open) ... 3 (close) | |backness | number | -2 (back) ... 2 (front) | |rounded | boolean | | |roundednessModifier| String | none, more or less| |rhotacized | boolean | | |tongueRoot | String | neutral, advanced or retracted|

Consonant specifics properties :

| name | type | | | --- | --- | --- | | manner | String | stop, fricative, approximant, flap, tapped-fricative, trill, trilled-fricative or vowel| | secondary | String | none, bilabial, palatal, velar or pharyngeal| | places | Arrays of String | bilabial, labiodental, dental, alveolar, postalveolar, retroflex, alveopalatal, palatal, velar, uvular, pharyngal, epiglottal and glottal | | coronalType | String | unspecified,laminal or apical | | lateral | boolean | | | ejective | boolean | | | release | String |unaspirated, aspirated, nasal-release, lateral-release or no-audible-release|

Voicing

| name | values | |--- |--- | |voiced | boolean | |phonation|voiceless, modal, breathy or creaky|

Diphtong, Triphtong

Not define in IPA chart, not supported by this parser. Combinaison with a tie bar (a͡ɪ) or a with a superscript (aᶦ) will be reject.

Tone

IPA define two way to describe tones :

  • One tone mark on a segmental letter, like é. The tone-unit wll be returned just after the segmental-unit (warning : tone-unit may not be at the end of the syllabe or word).
  • One or many tone letters, describing visually the tone : like e˦˨˥. One tone-unit will be returned for the group of tone letters. Warning :

In both way, the unit will contain two informations :

  • name : the name of the accent. If a tone letters group do not matches a tone define by IPA, the name will be other.
  • heights : an array of number describing the differents highs of the accent. 1 is the lowest and 5 the highest tone. If a mark and tones letters describe the same accent, they will arrive return the same unit (same name and same highs).

|Mark|Letters|name |heights|Mark|Letters|name |heights | |:--:|:---: | --- |--- |:--:|:---: | --- | --- | | e̋ | ˥ |extra-high|[5] | ě | ˩˥ | rising |[1,5] | | é | ˦ |high |[4] | ê | ˥˩ | falling |[5,1] | | ē | ˧ |mid |[3] | e᷄ | ˦˥ | high-rising |[4,5] | | è | ˨ |low |[2] | e᷅ | ˩˨ | low-rising |[1,2] | | ȅ | ˩ |extra-low |[1] | e᷇ | ˥˦ | high-falling |[5,4] | | | | | | e᷆ | ˧˨ | low-falling |[2,1] | | | | | | e᷈ | ˧˦˧ | rising-falling|[3,4,3] | | | | | | e᷉ | ˧˨˧ | falling-rising|[3,2,3] |

Examples

Example 1 : ̌ or ˩˥

{
    "category": "tone",
    "segment": false,
    "name":"rising",
    "highs":[1,5]
}

Example 2 : ˧˦˩

{
    "category": "tone",
    "segment": false,
    "name":"other",
    "highs":[3,4,1]
}

Intonation, Tone-Step, Stress and Separator

Execpt tone and quantity, all other supra-segmental information will be returned with the same format :

  • category: identifie the category of the supra-segmental
  • value : a string describing the information in the category

| character | IPA | category | value | | :---: | --- | --- | --- | | . | Syllable break | separator | syllable-break | | ‿ | Linking (absence of a break) | separator | linking |
| | | Minor (foot) group | separator | minor-group | | ‖ | Major (intonation) group | separator | major-group | | ˈ | Primary stress | stress | primary-stress | | ˌ | Secondary stress | stress | secondary-stress| | ꜜ | Downstep | tone-step | downstep | | ꜛ | Upstep | tone-step | upstep | | ↗ | Global rise | intonation| global-rise | | ↘ | Global fall | intonation| global-fall |

Nota : "Extra-stress", sometimes write with double line (ˈˈ), is not supported and will be return as two primary stress.

Example

{
    "category": "separator",
    "segment": false,
    "value": "syllable"
}

Invalid input

If the input is not a valid IPA string, throw an error.

  • IpaCharacterError
  • IpaSyntaxError

Discussion

Segment, Phone, Phoneme

Phone represent a speech decomposition and are used in phonetic transcription. Phoneme represent a disctinctive sound for a given language and are used for phonemic transcription.

The same symbol are used in IPA for phonetic and phonemic trancription. This parser will return the narrower description for one symbole as described in unicode

ex: n could represent a dental, alveolar or postalveolar. The parser will return a description with alveolar

Source

IPA chart : chart IPA symbol encoding : unicode