Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
daanzu committed May 6, 2019
1 parent 6fede94 commit 27b74ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ Or use your own model. Standard Kaldi models must be converted to be usable. Con

Please feel free to submit issues, suggestions, and feature requests. Pull requests are considered, but project structure is in flux.

Donations are appreciated to encourage development. [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/daanzu)
Donations are appreciated to encourage development.

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/daanzu)

## Author

Expand Down
10 changes: 6 additions & 4 deletions kaldi_active_grammar/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ def __init__(self, data_dir, tmp_dir=None):
self.exec_dir = os.path.join(get_exec_dir(), '')
self.data_dir = os.path.join(data_dir or '', '')
self.tmp_dir = os.path.join(tmp_dir or 'kaldi_tmp', '')
if not os.path.exists(self.exec_dir): raise KaldiError("cannot find exec_dir")
if not os.path.exists(self.data_dir): raise KaldiError("cannot find data_dir")
if not os.path.exists(self.tmp_dir): os.mkdir(self.tmp_dir)
if not os.path.exists(self.exec_dir): raise KaldiError("cannot find exec_dir: %r" % exec_dir)
if not os.path.exists(self.data_dir): raise KaldiError("cannot find data_dir: %r" % data_dir)
if not os.path.exists(self.tmp_dir):
_log.warning("%s: creating tmp dir: %r" % (self, self.tmp_dir))
os.mkdir(self.tmp_dir)

self.files_dict = {
'exec_dir': self.exec_dir,
Expand Down Expand Up @@ -103,7 +105,7 @@ def __init__(self, data_dir, tmp_dir=None):
nonterminals = tuple(['#nonterm:dictation'] + ['#nonterm:rule%i' % i for i in range(_max_rule_id + 1)])

default_dictation_g_filepath = property(lambda self: os.path.join(self.data_dir, 'G_dictation.fst'))
_dictation_fst_filepath = property(lambda self: os.path.join(self.tmp_dir, 'Dictation.fst'))
_dictation_fst_filepath = property(lambda self: os.path.join(self.data_dir, 'Dictation.fst'))

def load_words(self, words_file=None, unigram_probs_file=None):
if words_file is None: words_file = self.files_dict['words.txt']
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_tag(self):
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.1.0-dev2', # Required
version='0.1.0.dev3', # Required
# version=open('VERSION').read().strip(),

# This is a one-line description or tagline of what your project does. This
Expand Down

0 comments on commit 27b74ce

Please sign in to comment.