-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.qmd
93 lines (71 loc) · 2.07 KB
/
README.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
title: fave-syllabify
date-modified: today
format: gfm
---
![](https://img.shields.io/badge/Lifecycle-Maturing-lightgreen@2x)
![PyPI version](https://badge.fury.io/py/fave-syllabify.svg)
[![Lint and Test](https://github.com/Forced-Alignment-and-Vowel-Extraction/fave-syllabify/actions/workflows/lint-and-test.yml/badge.svg)](https://github.com/Forced-Alignment-and-Vowel-Extraction/fave-syllabify/actions/workflows/lint-and-test.yml)
[![Build Docs](https://github.com/Forced-Alignment-and-Vowel-Extraction/fave-syllabify/actions/workflows/build_docs.yml/badge.svg)](https://forced-alignment-and-vowel-extraction.github.io/fave-syllabify/)
[![codecov](https://codecov.io/gh/Forced-Alignment-and-Vowel-Extraction/fave-syllabify/graph/badge.svg?token=WDBJ0O9P6L)](https://codecov.io/gh/Forced-Alignment-and-Vowel-Extraction/fave-syllabify)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10708119.svg)](https://doi.org/10.5281/zenodo.10708119)
Syllabify a force-aligned TextGrid
## Installation
```bash
pip install fave-syllabify
```
## Usage
Import classes and functions
```{python}
from aligned_textgrid import AlignedTextGrid, custom_classes
from fave_syllabify import syllabify_tg
from pathlib import Path
```
Read in a textgrid
```{python}
tg = AlignedTextGrid(
textgrid_path=Path(
"docs",
"data",
"josef-fruehwald_speaker.TextGrid"
),
entry_classes=custom_classes(
["Word", "Phone"]
)
)
print(tg)
```
Syllabify the textgrid
```{python}
syllabify_tg(tg)
print(tg)
```
### Exploring the syllabification
```{python}
word_tier = tg.group_0.Word
raindrops = word_tier[5]
print(raindrops.label)
```
Each syllable is labelled with its stress.
```{python}
print([
syl.label
for syl in raindrops.contains
])
```
Each syllable contains its constituent parts in a flat hierarchy (there's no rhyme constituent).
```{python}
syl = raindrops.first.fol
print([
part.label
for part in syl.contains
])
```
Each constituent contains its relevant phone.
```{python}
onset = syl.onset
print([
phone.label
for phone in onset
])
```