Skip to content

Commit

Permalink
make phn2annot case-insensitive for phn files, fix #68
Browse files Browse the repository at this point in the history
by using the modified `_parse_file` function
that can accept multiple extensions as valid

`phn2annot` will now check for both `.phn` and `.PHN` extensions
  • Loading branch information
NickleDave committed Jan 7, 2021
1 parent e5d85ac commit c1708d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/crowsetta/phn.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def phn2annot(annot_path,
due to floating point error, e.g. when loading .phn files and then sending them to
a csv file, the result should be the same on Windows and Linux
"""
annot_path = _parse_file(annot_path, extension='.phn')
# note multiple extensions, both all-uppercase and all-lowercase `.phn` exist,
# depending on which version of TIMIT dataset you have
annot_path = _parse_file(annot_path, extension=('.phn', '.PHN'))

if abspath and basename:
raise ValueError('abspath and basename arguments cannot both be set to True, '
Expand Down Expand Up @@ -144,7 +146,7 @@ def phn2csv(annot_path, csv_filename, abspath=False, basename=False):
-------
None
"""
annot_path = _parse_file(annot_path, extension='.phn')
annot_path = _parse_file(annot_path, extension=('.phn', '.PHN'))

if abspath and basename:
raise ValueError('abspath and basename arguments cannot both be set to True, '
Expand Down

0 comments on commit c1708d5

Please sign in to comment.