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

Feature/parselmouth fix #85

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ docs/_build
*.swp
*.orig
env
dist/*
dist/*
.ipynb_checkpoints/*
venv/
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ You can fill in a bug report at the [issue tab](https://github.com/JoFrhwld/FAVE
There may be a delay between when a bug is reported and when a bug is resolved. Developers prioritize bugs based on difficulty, importance, and other factors, so bug reports are usually not handled in the order they are received.

## Attribution
[![DOI](https://zenodo.org/badge/13744621.svg)](https://zenodo.org/badge/latestdoi/13744621)
![GitHub](https://img.shields.io/github/license/JoFrhwld/FAVE)
![GitHub](https://img.shields.io/badge/Python-3.8%2B-brightgreen)
[![PyPI version fury.io](https://badge.fury.io/py/fave.svg)](https://pypi.python.org/pypi/fave/)

[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.22281.svg)](http://dx.doi.org/10.5281/zenodo.22281)
As of v1.1.3 onwards, releases from this repository will have a DOI associated with them through Zenodo. The DOI for the current release is [10.5281/zenodo.22281](http://dx.doi.org/10.5281/zenodo.22281). We would recommend the citation:

Rosenfelder, Ingrid; Fruehwald, Josef; Brickhouse, Christian; Evanini, Keelan; Seyfarth, Scott; Gorman, Kyle; Prichard, Hilary; Yuan, Jiahong; 2022. FAVE (Forced Alignment and Vowel Extraction) Program Suite v2.0.0 */zenodo.*
Expand Down
34 changes: 18 additions & 16 deletions fave/align/aligner.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from . import transcriptprocessor
from fave import cmudictionary
from fave import praat

import parselmouth

class Aligner():
"""
Expand Down Expand Up @@ -129,21 +129,23 @@ def get_duration(self, FADIR='', PRAATPATH=''):
f.close()
duration = round((nx / sr), 3)
except wave.Error: # wave.py does not seem to support 32-bit .wav files???
self.logger.debug('Script path is %s',os.path.join(
FADIR, "praatScripts", "get_duration.praat"))
if PRAATPATH:
dur_command = "%s %s %s" % (PRAATPATH, os.path.join(
FADIR, "praatScripts", "get_duration.praat"), self.audio)
else:
dur_command = "praat %s %s" % (os.path.join(
FADIR, "praatScripts", "get_duration.praat"), self.audio)
duration = round(
float(
subprocess.Popen(
dur_command,
shell=True,
stdout=subprocess.PIPE).communicate()[0].strip()),
3)
sound = parselmouth.Sound(self.audio)
duration = round(sound.duration, 3)
# self.logger.debug('Script path is %s',os.path.join(
# FADIR, "praatScripts", "get_duration.praat"))
# if PRAATPATH:
# dur_command = "%s %s %s" % (PRAATPATH, os.path.join(
# FADIR, "praatScripts", "get_duration.praat"), self.audio)
# else:
# dur_command = "praat %s %s" % (os.path.join(
# FADIR, "praatScripts", "get_duration.praat"), self.audio)
# duration = round(
# float(
# subprocess.Popen(
# dur_command,
# shell=True,
# stdout=subprocess.PIPE).communicate()[0].strip()),
# 3)

return duration

Expand Down
8 changes: 1 addition & 7 deletions fave/align/transcriptprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,7 @@ def read_transcription_file(self):
"""Reads file into memory"""
with open(self.file) as f:
lines = self.replace_smart_quotes(f.readlines())
self.lines = lines
try:
float(lines[0].split('\t')[2])
except ValueError:
# Log a warning about having detected a header row
self.logger.warning('Header row was detected')
del lines[0]
self.lines = lines
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reverts the header detection from #65, we should remember to fix this before merging


# substitute any 'smart' quotes in the input file with the corresponding
# ASCII equivalents (otherwise they will be excluded as out-of-
Expand Down
Loading