Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoFrhwld committed Feb 26, 2024
1 parent 04ded17 commit df7a5fa
Show file tree
Hide file tree
Showing 12 changed files with 349 additions and 22 deletions.
102 changes: 101 additions & 1 deletion README.md
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']
92 changes: 92 additions & 0 deletions README.qmd
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
])
```
8 changes: 8 additions & 0 deletions docs/_extensions/jofrhwld/codeblocklabel/_extension.yml
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 docs/_extensions/jofrhwld/codeblocklabel/codeblocklabel.css
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 docs/_extensions/jofrhwld/codeblocklabel/codeblocklabel.lua
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
12 changes: 12 additions & 0 deletions docs/_freeze/index/execute-results/html.json
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": {}
}
}
7 changes: 7 additions & 0 deletions docs/_freeze/site_libs/clipboard/clipboard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
project:
type: website
output-dir: _site

license: GPLv3

website:
Expand All @@ -13,14 +12,26 @@ website:
- file: index.qmd
text: Get Started
- href: reference/
text: Reference
text: Module Reference
right:
- icon: github
href: https://github.com/Forced-Alignment-and-Vowel-Extraction/fave-syllabify

format:
html:
theme:
light: flatly
dark: darkly
light:
- flatly
- styles/light.scss
dark:
- darkly
- styles/dark.scss
toc: true
css: styles/styles.css
date-modified: today

execute:
freeze: auto

# tell quarto to read the generated sidebar
metadata-files:
Expand Down
Loading

0 comments on commit df7a5fa

Please sign in to comment.