-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
349 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,103 @@ | ||
# fave-syllabify | ||
![Static Badge](https://img.shields.io/badge/%E2%9A%A0%EF%B8%8F-work_in_progress-red) | ||
|
||
|
||
![](https://img.shields.io/badge/Lifecycle-Maturing-lightgreen.png) | ||
![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) | ||
|
||
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) | ||
``` | ||
|
||
AlignedTextGrid with 1 groups named ['group_0'] each with [2] tiers. [['Word', 'Phone']] | ||
|
||
Syllabify the textgrid | ||
|
||
``` python | ||
syllabify_tg(tg) | ||
|
||
print(tg) | ||
``` | ||
|
||
AlignedTextGrid with 1 groups named ['group_0'] each with [4] tiers. [['Word', 'Syllable', 'SylPart', 'Phone']] | ||
|
||
### Exploring the syllabification | ||
|
||
``` python | ||
word_tier = tg.group_0.Word | ||
raindrops = word_tier[5] | ||
|
||
print(raindrops.label) | ||
``` | ||
|
||
raindrops | ||
|
||
Each syllable is labelled with its stress. | ||
|
||
``` python | ||
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). | ||
|
||
``` python | ||
syl = raindrops.first.fol | ||
print([ | ||
part.label | ||
for part in syl.contains | ||
]) | ||
``` | ||
|
||
['onset', 'nucleus', 'coda'] | ||
|
||
Each constituent contains its relevant phone. | ||
|
||
``` python | ||
onset = syl.onset | ||
print([ | ||
phone.label | ||
for phone in onset | ||
]) | ||
``` | ||
|
||
['D', 'R'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
title: fave-syllabify | ||
date-modified: today | ||
format: gfm | ||
--- | ||
|
||
![](https://img.shields.io/badge/Lifecycle-Maturing-lightgreen) | ||
![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) | ||
|
||
|
||
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 | ||
]) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
title: Codeblocklabel | ||
author: Josef Fruehwald | ||
version: 1.0.0 | ||
quarto-required: ">=1.3.0" | ||
contributes: | ||
filters: | ||
- codeblocklabel.lua | ||
|
10 changes: 10 additions & 0 deletions
10
docs/_extensions/jofrhwld/codeblocklabel/codeblocklabel.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.langname { | ||
margin-bottom: 0%; | ||
padding-bottom: 0%; | ||
font-style: italic; | ||
font-size:smaller; | ||
} | ||
|
||
.sourceCode[id]{ | ||
margin-top: 0%; | ||
} |
30 changes: 30 additions & 0 deletions
30
docs/_extensions/jofrhwld/codeblocklabel/codeblocklabel.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
-- function Div(el) | ||
-- if el.content[1].t == "CodeBlock" then | ||
-- return pandoc.Para("CodeBlock!") | ||
-- end | ||
-- end | ||
|
||
quarto.doc.add_html_dependency({ | ||
name = 'codenamelabel', | ||
stylesheets = {'codeblocklabel.css'} | ||
}) | ||
|
||
function CodeBlock(block) | ||
local newblock = block | ||
if (FORMAT:match "html") and | ||
(block.classes[1]) then | ||
local langname = block.classes[1] | ||
out = {pandoc.Div( | ||
pandoc.RawInline("html", | ||
"<pre class='langname'>"..block.classes[1].."</pre>" | ||
), | ||
pandoc.Attr("", {"langname"}, {}) | ||
), | ||
newblock | ||
} | ||
else | ||
out = newblock | ||
end | ||
return out | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"hash": "ef2a64a3a8fd529816da9df2f0277792", | ||
"result": { | ||
"engine": "jupyter", | ||
"markdown": "---\ntitle: Fave Syllabify\nfilters: \n - codeblocklabel\n---\n\n![](https://img.shields.io/badge/Lifecycle-Maturing-lightgreen)\n![PyPI version](https://badge.fury.io/py/fave-syllabify.svg)\n[![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)\n[![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/)\n[![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)\n\nThis is a work in progress.\n\n## Installation\n\n```bash\npip install fave-syllabify\n```\n\n## Usage\n\nImport classes and functions\n\n::: {#1c825624 .cell execution_count=1}\n``` {.python .cell-code}\nfrom aligned_textgrid import AlignedTextGrid, custom_classes\nfrom fave_syllabify import syllabify_tg\nfrom pathlib import Path\n```\n:::\n\n\nRead in a textgrid\n\n::: {#1ed0427d .cell execution_count=2}\n``` {.python .cell-code}\ntg = AlignedTextGrid(\n textgrid_path=Path(\n \"data\",\n \"josef-fruehwald_speaker.TextGrid\"\n ),\n entry_classes=custom_classes(\n [\"Word\", \"Phone\"]\n )\n)\n\nprint(tg)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nAlignedTextGrid with 1 groups named ['group_0'] each with [2] tiers. [['Word', 'Phone']]\n```\n:::\n:::\n\n\nSyllabify the textgrid\n\n::: {#5c287f34 .cell execution_count=3}\n``` {.python .cell-code}\nsyllabify_tg(tg)\n\nprint(tg)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nAlignedTextGrid with 1 groups named ['group_0'] each with [4] tiers. [['Word', 'Syllable', 'SylPart', 'Phone']]\n```\n:::\n:::\n\n\n### Exploring the syllabification\n\n::: {#7cb04638 .cell execution_count=4}\n``` {.python .cell-code}\nword_tier = tg.group_0.Word\nraindrops = word_tier[5]\n\nprint(raindrops.label)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nraindrops\n```\n:::\n:::\n\n\nEach syllable is labelled with its stress.\n\n::: {#6051ed44 .cell execution_count=5}\n``` {.python .cell-code}\nprint([\n syl.label \n for syl in raindrops.contains\n])\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n['syl-1', 'syl-2']\n```\n:::\n:::\n\n\nEach syllable contains its constituent parts in a flat hierarchy (there's no rhyme constituent).\n\n::: {#e5bd2030 .cell execution_count=6}\n``` {.python .cell-code}\nsyl = raindrops.first.fol\nprint([\n part.label\n for part in syl.contains\n])\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n['onset', 'nucleus', 'coda']\n```\n:::\n:::\n\n\nEach constituent contains its relevant phone.\n\n::: {#b69b46a0 .cell execution_count=7}\n``` {.python .cell-code}\nonset = syl.onset\nprint([\n phone.label\n for phone in onset\n])\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n['D', 'R']\n```\n:::\n:::\n\n\n", | ||
"supporting": [ | ||
"index_files" | ||
], | ||
"filters": [], | ||
"includes": {} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.