Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.1.2 #4

Merged
merged 39 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4b128c1
run tests on dev
JoFrhwld Feb 18, 2024
33ae31f
revising testing action
JoFrhwld Feb 18, 2024
bce9190
fixing tests
JoFrhwld Feb 18, 2024
cfea765
test fixes
JoFrhwld Feb 18, 2024
17eafca
trying more elaborate poetry actions
JoFrhwld Feb 18, 2024
31ef82d
fixing windows test issue?
JoFrhwld Feb 18, 2024
12d0be3
docs
JoFrhwld Feb 18, 2024
f15fd42
installation, just in case
JoFrhwld Feb 18, 2024
7138948
Merge pull request #1 from Forced-Alignment-and-Vowel-Extraction/firs…
JoFrhwld Feb 18, 2024
224a08f
typos
JoFrhwld Feb 18, 2024
69ceed6
Merge pull request #2 from Forced-Alignment-and-Vowel-Extraction/firs…
JoFrhwld Feb 18, 2024
eff3dad
two step syllabify
JoFrhwld Feb 20, 2024
ef70150
interleave from word
JoFrhwld Feb 20, 2024
7472a81
aligned-textgrid update
JoFrhwld Feb 21, 2024
90d622a
moved syllabify logic into separate functions
JoFrhwld Feb 21, 2024
1cdb3a1
dependency update
JoFrhwld Feb 21, 2024
e39c6ea
set old id
JoFrhwld Feb 25, 2024
a57bc47
remove syllabify depenency
JoFrhwld Feb 25, 2024
b787b36
doc build fix
JoFrhwld Feb 25, 2024
462edf9
v0.1.1
JoFrhwld Feb 25, 2024
c6d3a72
docs build fix
JoFrhwld Feb 25, 2024
c2cbbf9
docs install root
JoFrhwld Feb 25, 2024
fe149c2
don't cache venv?
JoFrhwld Feb 25, 2024
9e310ff
export functions
JoFrhwld Feb 25, 2024
732d1d6
set up tests
JoFrhwld Feb 25, 2024
781bcf6
syllabify tests
JoFrhwld Feb 25, 2024
f021dde
ignore vscode
JoFrhwld Feb 25, 2024
11f33bb
upgrade cache action
JoFrhwld Feb 25, 2024
5665583
codecov
JoFrhwld Feb 25, 2024
638cc1f
coverage py
JoFrhwld Feb 25, 2024
57dd400
configuring codecov
JoFrhwld Feb 25, 2024
04ded17
nicer accessors
JoFrhwld Feb 26, 2024
df7a5fa
docs
JoFrhwld Feb 26, 2024
5c3fe91
version bump
JoFrhwld Feb 26, 2024
8ae0e2e
Create CITATION.cff
JoFrhwld Feb 26, 2024
2a54c1f
docs update
JoFrhwld Feb 26, 2024
ebff249
freeze update
JoFrhwld Feb 26, 2024
72933ec
docs update
JoFrhwld Feb 26, 2024
9879c21
docstring fix
JoFrhwld Feb 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/build_docs.yml
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
47 changes: 36 additions & 11 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

notebooks/
docs/_site
.vscode/
28 changes: 28 additions & 0 deletions CITATION.cff
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
102 changes: 102 additions & 0 deletions README.md
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']
93 changes: 93 additions & 0 deletions README.qmd
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
])
```
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
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%;
}
Loading