diff --git a/docs/_freeze/index/execute-results/html.json b/docs/_freeze/index/execute-results/html.json index 62fb3b4..f97d1e6 100644 --- a/docs/_freeze/index/execute-results/html.json +++ b/docs/_freeze/index/execute-results/html.json @@ -1,8 +1,8 @@ { - "hash": "12c9d4442e61060cc3877567e2f9d536", + "hash": "02fff43ebaeea8f653d98489556b06e3", "result": { "engine": "jupyter", - "markdown": "---\ntitle: Fave Syllabify\nfilters: \n - codeblocklabel\n---\n\n![](https://img.shields.io/badge/Lifecycle-Maturing-lightgreen@2x)\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[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10708119.svg)](https://doi.org/10.5281/zenodo.10708119)\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::: {#94c77a50 .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::: {#d0e62d61 .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::: {#5e08530e .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::: {#bb77df59 .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::: {#c05a213b .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::: {#9d648c05 .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::: {#5e0582f1 .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", + "markdown": "---\ntitle: Fave Syllabify\nfilters: \n - codeblocklabel\n---\n\n![](https://img.shields.io/badge/Lifecycle-Maturing-lightgreen@2x)\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[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10708119.svg)](https://doi.org/10.5281/zenodo.10708119)\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::: {#91585903 .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::: {#ce987631 .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::: {#6a0cdda5 .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::: {#9d11e9d9 .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::: {#9ca820b5 .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::: {#70e135f7 .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::: {#b0956389 .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## Quickly syllabify and save the results\n\nTo quickly open, syllabify, and save the resulting textgrid (see also [the aligned-textgrid docs](https://forced-alignment-and-vowel-extraction.github.io/alignedTextGrid/usage/05_Outputs/00_to_textgrid.html))\n\n::: {#f4f8a272 .cell execution_count=8}\n``` {.python .cell-code}\n# Get the relevant imports\nfrom aligned_textgrid import AlignedTextGrid, custom_classes\nfrom fave_syllabify import syllabify_tg\n\n# Load the Word and Phone aligned textgrid\ntg = AlignedTextGrid(\n textgrid_path=\"data/josef-fruehwald_speaker.TextGrid\",\n entry_classes=custom_classes(\n [\"Word\", \"Phone\"]\n )\n)\n\n# Syllabify (this modifies the tg object itself)\nsyllabify_tg(tg)\n\n# Save the result\ntg.save_textgrid(\n save_path = \"data/syllabified.TextGrid\"\n)\n```\n:::\n\n\n", "supporting": [ "index_files" ], diff --git a/docs/_quarto.yml b/docs/_quarto.yml index 2080891..8dbd65e 100644 --- a/docs/_quarto.yml +++ b/docs/_quarto.yml @@ -42,6 +42,7 @@ quartodoc: package: fave_syllabify style: pkgdown dir: reference + version: 0.1.2 # write sidebar data to this file sidebar: "reference/_sidebar.yml" parser: google diff --git a/docs/index.qmd b/docs/index.qmd index 8bb30ea..950e42d 100644 --- a/docs/index.qmd +++ b/docs/index.qmd @@ -87,4 +87,30 @@ print([ phone.label for phone in onset ]) +``` + +## Quickly syllabify and save the results + +To quickly open, syllabify, and save the resulting textgrid (see also [the aligned-textgrid docs](https://forced-alignment-and-vowel-extraction.github.io/alignedTextGrid/usage/05_Outputs/00_to_textgrid.html)) + +```{python} +# Get the relevant imports +from aligned_textgrid import AlignedTextGrid, custom_classes +from fave_syllabify import syllabify_tg + +# Load the Word and Phone aligned textgrid +tg = AlignedTextGrid( + textgrid_path="data/josef-fruehwald_speaker.TextGrid", + entry_classes=custom_classes( + ["Word", "Phone"] + ) +) + +# Syllabify (this modifies the tg object itself) +syllabify_tg(tg) + +# Save the result +tg.save_textgrid( + save_path = "data/syllabified.TextGrid" +) ``` \ No newline at end of file diff --git a/docs/objects.json b/docs/objects.json index 418df00..ae65139 100644 --- a/docs/objects.json +++ b/docs/objects.json @@ -1 +1 @@ -{"project": "fave_syllabify", "version": "0.0.9999", "count": 3, "items": [{"name": "fave_syllabify.syllabify.syllabify_tg", "domain": "py", "role": "function", "priority": "1", "uri": "reference/syllabify.html#fave_syllabify.syllabify.syllabify_tg", "dispname": "-"}, {"name": "fave_syllabify.syllabify.syllabify_word", "domain": "py", "role": "function", "priority": "1", "uri": "reference/syllabify.html#fave_syllabify.syllabify.syllabify_word", "dispname": "-"}, {"name": "fave_syllabify.syllabify", "domain": "py", "role": "module", "priority": "1", "uri": "reference/syllabify.html#fave_syllabify.syllabify", "dispname": "-"}]} \ No newline at end of file +{"project": "fave_syllabify", "version": "0.0.9999", "count": 4, "items": [{"name": "fave_syllabify.syllabify.make_syllable_constituents", "domain": "py", "role": "function", "priority": "1", "uri": "reference/syllabify.html#fave_syllabify.syllabify.make_syllable_constituents", "dispname": "-"}, {"name": "fave_syllabify.syllabify.syllabify_tg", "domain": "py", "role": "function", "priority": "1", "uri": "reference/syllabify.html#fave_syllabify.syllabify.syllabify_tg", "dispname": "-"}, {"name": "fave_syllabify.syllabify.syllabify_word", "domain": "py", "role": "function", "priority": "1", "uri": "reference/syllabify.html#fave_syllabify.syllabify.syllabify_word", "dispname": "-"}, {"name": "fave_syllabify.syllabify", "domain": "py", "role": "module", "priority": "1", "uri": "reference/syllabify.html#fave_syllabify.syllabify", "dispname": "-"}]} \ No newline at end of file diff --git a/docs/reference/syllabify.qmd b/docs/reference/syllabify.qmd index 652e9a6..fa91600 100644 --- a/docs/reference/syllabify.qmd +++ b/docs/reference/syllabify.qmd @@ -8,9 +8,22 @@ | Name | Description | | --- | --- | +| [make_syllable_constituents](#fave_syllabify.syllabify.make_syllable_constituents) | Make syllable constituents for a word interval | | [syllabify_tg](#fave_syllabify.syllabify.syllabify_tg) | Syllabify an entire AlignedTextGrid | | [syllabify_word](#fave_syllabify.syllabify.syllabify_word) | Syllabify a single word | +### make_syllable_constituents { #fave_syllabify.syllabify.make_syllable_constituents } + +`syllabify.make_syllable_constituents(word)` + +Make syllable constituents for a word interval + +#### Parameters + +| Name | Type | Description | Default | +|--------|-----------------------------------|--------------------------------|------------| +| `word` | aligned_textgrid.SequenceInterval | A SequenceInterval for a word. | _required_ | + ### syllabify_tg { #fave_syllabify.syllabify.syllabify_tg } `syllabify.syllabify_tg(tg)`