Skip to content

Commit

Permalink
added a block def and cmusphinx test
Browse files Browse the repository at this point in the history
  • Loading branch information
a2un committed Oct 15, 2017
1 parent 41b1a8a commit 0ada7ea
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
17 changes: 16 additions & 1 deletion blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,19 @@ def hash(block):
pass
@property
def last_block(self):
pass
pass


def main():

block = {
"index":1,
"timestamp":3423423423423.234
"transactions":{
"sender":"kychashS",
"recipient":"kychashR",
"amount":"5"
},
"proof": 324251234234,
"previous_hash":'2clhkghf3q42342345odapasuropdhfjkldshfy'
}
5 changes: 5 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from pocketsphinx import AudioFile

audio = AudioFile(lm=False, keyphrase='forward', kws_threshold=1e+20)
for phrase in audio:
print(phrase.segments(detailed=True)) # => "[('forward', -617, 63, 121)]"
21 changes: 21 additions & 0 deletions test1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
from pocketsphinx import DefaultConfig, Decoder, get_model_path, get_data_path

model_path = get_model_path()
data_path = get_data_path()

# Create a decoder with a certain model
config = DefaultConfig()
config.set_string('-hmm', os.path.join(model_path, 'en-us'))
config.set_string('-lm', os.path.join(model_path, 'en-us.lm.bin'))
config.set_string('-dict', os.path.join(model_path, 'cmudict-en-us.dict'))
decoder = Decoder(config)

# Decode streaming data
buf = bytearray(1024)
with open(os.path.join(data_path, 'goforward.raw'), 'rb') as f:
decoder.start_utt()
while f.readinto(buf):
decoder.process_raw(buf, False, False)
decoder.end_utt()
print('Best hypothesis segments:', [seg.word for seg in decoder.seg()])

0 comments on commit 0ada7ea

Please sign in to comment.