Skip to content

Commit

Permalink
Use load wrapper in cli to support more file types
Browse files Browse the repository at this point in the history
  • Loading branch information
thequilo committed Jan 5, 2024
1 parent 62ad630 commit 9575bca
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions meeteval/wer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _load(path: Path):

def _load_reference(reference: 'Path | list[Path]'):
"""Loads a reference transcription file. Currently only STM supported"""
return STM.load(reference)
return meeteval.io.load(reference)


def _load_hypothesis(hypothesis: 'list[Path]'):
Expand All @@ -115,14 +115,12 @@ def _load_hypothesis(hypothesis: 'list[Path]'):
return CTMGroup.load(hypothesis).to_stm()
else:
return CTMGroup.load([hypothesis]).to_stm()
elif filename.endswith('.stm'):
return STM.load(hypothesis)
elif filename.startswith('/dev/fd/') or filename.startswith('/proc/self/fd/'):
# This is a pipe, i.e. python -m ... <(cat ...)
# For now, assume it is an STM file
return STM.load(hypothesis)
else:
raise RuntimeError(hypothesis, filename)
return meeteval.io.load(hypothesis)


def _load_texts(reference_paths: 'list[str]', hypothesis_paths: 'list[str]', regex) -> 'tuple[STM, list[Path], STM, list[Path]]':
Expand Down

0 comments on commit 9575bca

Please sign in to comment.