Skip to content

Commit

Permalink
tutorial bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
oadams committed Jul 15, 2018
1 parent 9098cf5 commit 0745b8a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ interpreter. Back to the terminal:
$ ipython
> from persephone import corpus
> corp = corpus.Corpus("fbank", "phonemes", "data/na_example")
> from persephone import run
> run.train_ready(corp)
> from persephone import experiment
> experiment.train_ready(corp)

You'll should now see something like:

Expand Down
21 changes: 14 additions & 7 deletions persephone/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def get_untranscribed_prefixes_from_file(target_directory: Path) -> List[str]:

return [prefix.strip() for prefix in prefixes]
else:
logger.warning("Attempting to get untranscribed prefixes but the file ({})"
" that should specify these does not exist".format(untranscribed_prefix_fn))
#logger.warning("Attempting to get untranscribed prefixes but the file ({})"
# " that should specify these does not exist".format(untranscribed_prefix_fn))
pass
return []


class Corpus:
""" Represents a preprocessed corpus that is ready to be used in model
training.
Expand Down Expand Up @@ -146,11 +146,16 @@ def __init__(self, feat_type: str, label_type: str, tgt_dir: Path, labels: Optio
included in the corpus.
"""

if speakers:
raise NotImplementedError("Speakers not implemented")

logger.debug("Creating a new Corpus object with feature type %s, label type %s,"
"target directory %s, label set %s, ms, max_samples, speakers")

# In case path is supplied as a string, make it a Path
self.tgt_dir = Path(tgt_dir)

This comment has been minimized.

Copy link
@shuttle1987

shuttle1987 Jul 17, 2018

Member

Is this where mypy was complaining?


#: A string representing the type of speech feature (eg. "fbank"
#: for log filterbank energies).
self.feat_type = feat_type
Expand All @@ -161,13 +166,12 @@ def __init__(self, feat_type: str, label_type: str, tgt_dir: Path, labels: Optio

# Setting up directories
# Set the directory names
self.tgt_dir = tgt_dir
self.feat_dir = self.get_feat_dir()
self.wav_dir = self.get_wav_dir()
self.label_dir = self.get_label_dir()
logger.debug("Setting up directories for this Corpus object at %s", tgt_dir)
self.set_and_check_directories(tgt_dir)

logger.debug("Setting up directories for this Corpus object at %s", self.tgt_dir)
self.set_and_check_directories(self.tgt_dir)

# Label-related stuff
if labels is not None:
Expand Down Expand Up @@ -258,6 +262,9 @@ def from_elan(cls: Type[CorpusT], org_dir: Path, tgt_dir: Path,
if not label_segmenter:
raise ValueError("A label segmenter must be provided via label_segmenter")

# In case path is supplied as a string, make it a Path
self.tgt_dir = Path(tgt_dir)

# Read utterances from org_dir.
utterances = elan.utterances_from_dir(org_dir,
tier_prefixes=tier_prefixes)
Expand Down

0 comments on commit 0745b8a

Please sign in to comment.