Skip to main content

Syllabify force-aligned textgrids

Project description

fave-syllabify

PyPI version Lint and Test Build Docs codecov DOI

Syllabify a force-aligned TextGrid

Installation

pip install fave-syllabify

Usage

Import classes and functions

from aligned_textgrid import AlignedTextGrid, custom_classes
from fave_syllabify import syllabify_tg
from pathlib import Path

Read in a textgrid

tg = AlignedTextGrid(
    textgrid_path=Path(
        "docs",
        "data",
        "josef-fruehwald_speaker.TextGrid"
    ),
    entry_classes=custom_classes(
        ["Word", "Phone"]
    )
)

print(tg)
AlignedTextGrid with 1 groups named ['group_0'] each with [2] tiers. [['Word', 'Phone']]

Syllabify the textgrid

syllabify_tg(tg)

print(tg)
AlignedTextGrid with 1 groups named ['group_0'] each with [4] tiers. [['Word', 'Syllable', 'SylPart', 'Phone']]

Exploring the syllabification

word_tier = tg.group_0.Word
raindrops = word_tier[5]

print(raindrops.label)
raindrops

Each syllable is labelled with its stress.

print([
    syl.label 
    for syl in raindrops.contains
])
['syl-1', 'syl-2']

Each syllable contains its constituent parts in a flat hierarchy (there’s no rhyme constituent).

syl = raindrops.first.fol
print([
    part.label
    for part in syl.contains
])
['onset', 'nucleus', 'coda']

Each constituent contains its relevant phone.

onset = syl.onset
print([
    phone.label
    for phone in onset
])
['D', 'R']

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

fave_syllabify-0.1.3.tar.gz (16.0 kB view hashes)

Uploaded Source

Built Distribution

fave_syllabify-0.1.3-py3-none-any.whl (15.9 kB view hashes)

Uploaded Python 3

Supported by

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