-
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.
Merge pull request #4 from Forced-Alignment-and-Vowel-Extraction/dev
v0.1.2
- Loading branch information
Showing
31 changed files
with
8,608 additions
and
36 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build Docs | ||
|
||
on: | ||
push: | ||
branches: ["main", "dev"] | ||
|
||
jobs: | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: setup-python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
# - name: Load cached venv | ||
# id: cached-poetry-dependencies | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: .venv | ||
# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --with docs | ||
- name: Quardo Doc Build | ||
run: | | ||
poetry run quartodoc build --config docs/_quarto.yml | ||
- uses: quarto-dev/quarto-actions/setup@v2 | ||
- name: Render and publish to gh pages | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Quarto GHA Workflow Runner" | ||
poetry run quarto publish gh-pages docs --no-browser |
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 |
---|---|---|
|
@@ -4,37 +4,62 @@ on: | |
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
branches: | ||
- main | ||
- dev | ||
|
||
jobs: | ||
build: | ||
runs-on: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.10, 3.11, 3.12] | ||
|
||
python-version: ["3.10", "3.11", "3.12"] | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
id: setup-python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
export PATH="$HOME/.poetry/bin:$PATH" | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root --with dev | ||
|
||
- name: Run tests | ||
run: poetry run pytest | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: Forced-Alignment-and-Vowel-Extraction/fave-syllabify | ||
files: coverage.xml |
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
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,28 @@ | ||
# This CITATION.cff file was generated with cffinit. | ||
# Visit https://bit.ly/cffinit to generate yours today! | ||
|
||
cff-version: 1.2.0 | ||
title: fave-syllabify | ||
message: 'If you use this software, please cite it as below.' | ||
type: software | ||
authors: | ||
- family-names: Fruehwald | ||
given-names: Josef | ||
orcid: 'https://orcid.org/0000-0001-8480-9461' | ||
identifiers: | ||
- type: doi | ||
value: 10.5281/zenodo.10708119 | ||
repository-code: >- | ||
https://github.com/Forced-Alignment-and-Vowel-Extraction/fave-syllabify | ||
url: >- | ||
https://forced-alignment-and-vowel-extraction.github.io/fave-syllabify | ||
repository-artifact: 'https://zenodo.org/records/10708119' | ||
abstract: A python library to syllabify a force-aligned textgrid. | ||
keywords: | ||
- linguistics | ||
- computational linguistics | ||
- phonetics | ||
license: GPL-3.0 | ||
version: 0.1.2 | ||
date-released: '2024-02-26' | ||
doi: 10.5281/zenodo.10708119 |
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,2 +1,104 @@ | ||
# fave-syllabify | ||
|
||
|
||
![](https://img.shields.io/badge/[email protected]) | ||
![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) | ||
``` | ||
|
||
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,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 | ||
]) | ||
``` |
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 @@ | ||
/.quarto/ |
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%; | ||
} |
Oops, something went wrong.