Skip to content

Commit

Permalink
Merge pull request #19 from timmahrt/pysle_4.0.1
Browse files Browse the repository at this point in the history
Pysle 4.0.1
  • Loading branch information
timmahrt authored Jul 15, 2023
2 parents 8ebb702 + 121f5a8 commit 4c50bed
Show file tree
Hide file tree
Showing 25 changed files with 6,627 additions and 6,970 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

*Pysle uses semantic versioning (Major.Minor.Patch)*

Ver 4.0.1 (July 15, 2023)
- pin praatio version to 6.0

Ver 4.0 (Jan 3, 2022)
- lazy load the isleDict; boot up time changed from ~20s to ~0.5s
- refactor code to be object-oriented
Expand Down
28 changes: 28 additions & 0 deletions DEVELOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

These are development notes for myself

## Documentation

Documentation is generated with the following command:
`pdoc pysle -d google -o docs`

A live version can be seen with
`pdoc pysle -d google`

pdoc will read from pysle, as installed on the computer, so you may need to run `pip install .` if you want to generate documentation from a locally edited version of pysle.

## Tests

Tests are run with

`pytest --cov=pysle tests/`

## Release

Releases are built and deployed with:

`python setup.py bdist_wheel sdist`

`twine upload dist/*`

Don't forget to tag the release.
23 changes: 3 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ canonical dictionary pronunciation).
4. [Requirements](#requirements)
5. [ISLE Dictionary](#isle-dictionary)
6. [Installation](#installation)
7. [Version 3 to 4 Migration](#version-3-to-4-migration)
7. [Upgrading](#upgrading)
8. [Usage](#usage)
9. [Common Use Cases](#common-use-cases)
10. [Tests](#tests)
Expand All @@ -37,9 +37,6 @@ Automatically generated pdocs can be found here:

http://timmahrt.github.io/pysle/

The documentation is generated with the following command:
`pdoc ./pysle -d google -o docs`

## Tutorials

There are tutorials available for learning how to use Pysle. These
Expand Down Expand Up @@ -102,16 +99,9 @@ If python is not in your path, you'll need to enter the full path e.g.

C:\Python36\python.exe setup.py install

## Version 3 to 4 Migration

The iterface to isle dictionaries, praattools, and pronunciationtools haven't changed so
much except for a bit of renaming.
## Upgrading

The expected return types have completely changed however--shifting to datatypes now defined
in `phonetics.py`. If you are struggling with migrating to version 4, please let me know.

Looking over changes to the example files may help show the changes that need to be made
to get the same results.
Please view [UPGRADING.md](https://github.com/timmahrt/pysle/blob/main/UPGRADING.md) for detailed information about how to upgrade from earlier versions.

## Usage

Expand Down Expand Up @@ -167,13 +157,6 @@ What can you do with this library?
pysle.syllabifyTextgrid(isleDict, praatioTextgrid, "words", "phones")
```

## Tests

I run tests with the following command (this requires pytest and pytest-cov to be installed):

`pytest --cov=pysle tests/`


## Citing pysle


Expand Down
20 changes: 20 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

This guide outlines steps to upgrading between versions.

For more information about the most recent version of Pysle, please see the documentation linked in the README file.

If you are having difficulty upgrading, please don't hesistate to open an issue or contact me.

# Table of contents
1. [Version 3 to 4](#version-3-to-4-migration)

## Version 3 to 4 Migration

The iterface to isle dictionaries, praattools, and pronunciationtools haven't changed so
much except for a bit of renaming.

The expected return types have completely changed however--shifting to datatypes now defined
in `phonetics.py`.

Looking over changes to the example files may help show the changes that need to be made
to get the same results.
236 changes: 3 additions & 233 deletions docs/index.html

Large diffs are not rendered by default.

170 changes: 89 additions & 81 deletions docs/pysle.html

Large diffs are not rendered by default.

2,685 changes: 1,337 additions & 1,348 deletions docs/pysle/isletool.html

Large diffs are not rendered by default.

4,186 changes: 2,051 additions & 2,135 deletions docs/pysle/phonetics.html

Large diffs are not rendered by default.

1,926 changes: 952 additions & 974 deletions docs/pysle/praattools.html

Large diffs are not rendered by default.

565 changes: 282 additions & 283 deletions docs/pysle/pronunciationtools.html

Large diffs are not rendered by default.

88 changes: 52 additions & 36 deletions docs/pysle/utilities.html

Large diffs are not rendered by default.

387 changes: 135 additions & 252 deletions docs/pysle/utilities/constants.html

Large diffs are not rendered by default.

1,225 changes: 599 additions & 626 deletions docs/pysle/utilities/errors.html

Large diffs are not rendered by default.

361 changes: 188 additions & 173 deletions docs/pysle/utilities/isle_io.html

Large diffs are not rendered by default.

363 changes: 191 additions & 172 deletions docs/pysle/utilities/phonetic_constants.html

Large diffs are not rendered by default.

835 changes: 419 additions & 416 deletions docs/pysle/utilities/search.html

Large diffs are not rendered by default.

275 changes: 145 additions & 130 deletions docs/pysle/utilities/utils.html

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions docs/search.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/syllabify_textgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
stressDetectionErrorMode="warning",
syllabificationErrorMode="warning",
)
tg.addTier(syllableTG.tierDict["syllable"])
tg.addTier(syllableTG.tierDict["tonicSyllable"])
tg.addTier(syllableTG.tierDict["tonicVowel"])
tg.addTier(syllableTG.getTier("syllable"))
tg.addTier(syllableTG.getTier("tonicSyllable"))
tg.addTier(syllableTG.getTier("tonicVowel"))

tg.save(
join(root, "pumpkins_with_syllables.TextGrid"),
Expand Down
2 changes: 1 addition & 1 deletion examples/textgrid_alignment_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

tg = textgrid.openTextgrid(inputFN, includeEmptyIntervals=False)

for tierName in tg.tierNameList[:]:
for tierName in tg.tierNames[:]:
if tierName == utteranceTierName:
continue
tg.removeTier(tierName)
Expand Down
12 changes: 6 additions & 6 deletions pysle/isletool.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def getLength(self, word: str, maxFlag: bool) -> Tuple[float, float]:
syllableCountList = []
phoneCountList = []

entryList = self.lookup(word)
for entry in entryList:
entries = self.lookup(word)
for entry in entries:
syllableList = []
phoneList = []
for syllabification in entry.syllabificationList:
Expand Down Expand Up @@ -253,11 +253,11 @@ def transcribe(
transcribedWordsList: List[phonetics.PhonemeList] = []
wordList = sentenceTxt.split(" ")
for word in wordList:
entryList = self.lookup(word)
entries = self.lookup(word)

phoneListsOrderedByEntry = [
syllabification.desyllabify()
for entry in entryList
for entry in entries
for syllabification in entry.syllabificationList
]
numPhones = [len(phoneList) for phoneList in phoneListsOrderedByEntry]
Expand All @@ -271,8 +271,8 @@ def transcribe(
transcribedWordsList.append(phoneListsOrderedByEntry[i])

def cleanPron(pron):
for val in [u"ˈ", u"ˌ", u" "]:
pron = pron.replace(val, u"")
for val in ["ˈ", "ˌ", " "]:
pron = pron.replace(val, "")
return pron

words: List[str] = [
Expand Down
Loading

0 comments on commit 4c50bed

Please sign in to comment.