Skip to content

Commit

Permalink
Add method to get keyword phrases to vocabcompiler
Browse files Browse the repository at this point in the history
This way they can be used by other STT engines as well
  • Loading branch information
Holzhaus committed Oct 8, 2014
1 parent 21ec990 commit 0643131
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
20 changes: 20 additions & 0 deletions client/vocabcompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import g2p
import brain
import jasperpath

try:
import cmuclmtk
except ImportError:
Expand Down Expand Up @@ -333,6 +335,24 @@ def get_phrases_from_module(module):
return module.WORDS if hasattr(module, 'WORDS') else []


def get_keyword_phrases():
"""
Gets the keyword phrases from the keywords file in the jasper data dir.
Returns:
A list of keyword phrases.
"""
phrases = []

with open(jasperpath.data('keyword_phrases'), mode="r") as f:
for line in f:
phrase = line.strip()
if phrase:
phrases.append(phrase)

return phrases


def get_all_phrases():
"""
Gets phrases from all modules.
Expand Down
18 changes: 18 additions & 0 deletions static/keyword_phrases
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
BE
BEING
BUT
DID
FIRST
IN
IS
IT
JASPER
NOW
OF
ON
RIGHT
SAY
WHAT
WHICH
WITH
WORK

0 comments on commit 0643131

Please sign in to comment.