Last active
August 29, 2015 14:17
-
-
Save jamesdavidson/3a44a474d6fa92f54566 to your computer and use it in GitHub Desktop.
Recognising single spoken words using CMU Sphinx4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APPLE AE P AH L | |
ORANGE AO R AH N JH | |
PEAR P EH R | |
MANDARIN M AE N D ER AH N | |
GRAPE G R EY P | |
BANANA B AH N AE N AH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Recognising single spoken words using CMU Sphinx4 by James Davidson. | |
; Copyright (c) 2015, released under the MIT License. | |
; | |
; Fire up the REPL: rlwrap java -cp classes clojure.main | |
; Copy and paste the code in. | |
; Wait for it to load... and then speak into your terminal! | |
; | |
; CMU Sphinx4 used under BSD style license. | |
(ns fruit | |
(:use clojure.repl) | |
(:import edu.cmu.sphinx.api.Configuration | |
edu.cmu.sphinx.api.LiveSpeechRecognizer)) | |
(def conf | |
(new Configuration)) | |
(.setAcousticModelPath conf "en-us/en-us") | |
(.setDictionaryPath conf "en-us/fruit") ; cmudict-en-us.dict | |
(if false | |
(.setLanguageModelPath conf "en-us/fruit.lm") ; en-us.lm.dmp | |
(do | |
(.setUseGrammar conf true) | |
(.setGrammarName conf "fruit") | |
(.setGrammarPath conf "en-us"))) | |
(def recognizer (new LiveSpeechRecognizer conf)) | |
(do | |
(.startRecognition recognizer true) | |
(def result (.getResult recognizer)) | |
(.stopRecognition recognizer) | |
(.getHypothesis result)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#JSGF v1.0; | |
grammar fruit; | |
public <item> = APPLE | ORANGE | PEAR | MANDARIN | GRAPE | BANANA ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Language model created by QuickLM on Fri Mar 27 05:35:12 EDT 2015 | |
Copyright (c) 1996-2010 Carnegie Mellon University and Alexander I. Rudnicky | |
The model is in standard ARPA format, designed by Doug Paul while he was at MITRE. | |
The code that was used to produce this language model is available in Open Source. | |
Please visit http://www.speech.cs.cmu.edu/tools/ for more information | |
The (fixed) discount mass is 0.5. The backoffs are computed using the ratio method. | |
This model based on a corpus of 6 sentences and 23 words | |
\data\ | |
ngram 1=23 | |
ngram 2=38 | |
ngram 3=35 | |
\1-grams: | |
-1.1950 </s> -0.3010 | |
-1.1950 <s> -0.2724 | |
-1.4960 AE -0.2624 | |
-1.2742 AH -0.2417 | |
-1.9731 AO -0.2869 | |
-1.9731 APPLE -0.2869 | |
-1.9731 B -0.2773 | |
-1.9731 BANANA -0.2964 | |
-1.9731 D -0.2964 | |
-1.9731 EH -0.2869 | |
-1.9731 ER -0.2773 | |
-1.9731 EY -0.2869 | |
-1.9731 G -0.2869 | |
-1.9731 GRAPE -0.2964 | |
-1.9731 JH -0.2724 | |
-1.9731 L -0.2724 | |
-1.9731 M -0.2869 | |
-1.9731 MANDARIN -0.2964 | |
-1.2742 N -0.2200 | |
-1.9731 ORANGE -0.2964 | |
-1.4960 P -0.2417 | |
-1.9731 PEAR -0.2869 | |
-1.4960 R -0.2417 | |
\2-grams: | |
-1.0792 <s> APPLE 0.0000 | |
-1.0792 <s> BANANA 0.0000 | |
-1.0792 <s> GRAPE 0.0000 | |
-1.0792 <s> MANDARIN 0.0000 | |
-1.0792 <s> ORANGE 0.0000 | |
-1.0792 <s> PEAR 0.0000 | |
-0.4771 AE N -0.2041 | |
-0.7782 AE P -0.2218 | |
-1.0000 AH </s> -0.3010 | |
-1.0000 AH L 0.0000 | |
-0.5229 AH N -0.1461 | |
-0.3010 AO R -0.2218 | |
-0.3010 APPLE AE -0.2218 | |
-0.3010 B AH -0.1461 | |
-0.3010 BANANA B 0.0000 | |
-0.3010 D ER 0.0000 | |
-0.3010 EH R -0.2218 | |
-0.3010 ER AH -0.1461 | |
-0.3010 EY P -0.2218 | |
-0.3010 G R -0.2218 | |
-0.3010 GRAPE G 0.0000 | |
-0.3010 JH </s> -0.3010 | |
-0.3010 L </s> -0.3010 | |
-0.3010 M AE -0.1249 | |
-0.3010 MANDARIN M 0.0000 | |
-1.0000 N </s> -0.3010 | |
-1.0000 N AE -0.1249 | |
-1.0000 N AH -0.2553 | |
-1.0000 N D 0.0000 | |
-1.0000 N JH 0.0000 | |
-0.3010 ORANGE AO 0.0000 | |
-0.7782 P </s> -0.3010 | |
-0.7782 P AH -0.2553 | |
-0.7782 P EH 0.0000 | |
-0.3010 PEAR P -0.2218 | |
-0.7782 R </s> -0.3010 | |
-0.7782 R AH -0.1461 | |
-0.7782 R EY 0.0000 | |
\3-grams: | |
-0.3010 <s> APPLE AE | |
-0.3010 <s> BANANA B | |
-0.3010 <s> GRAPE G | |
-0.3010 <s> MANDARIN M | |
-0.3010 <s> ORANGE AO | |
-0.3010 <s> PEAR P | |
-0.6021 AE N AH | |
-0.6021 AE N D | |
-0.3010 AE P AH | |
-0.3010 AH L </s> | |
-0.7782 AH N </s> | |
-0.7782 AH N AE | |
-0.7782 AH N JH | |
-0.3010 AO R AH | |
-0.3010 APPLE AE P | |
-0.3010 B AH N | |
-0.3010 BANANA B AH | |
-0.3010 D ER AH | |
-0.3010 EH R </s> | |
-0.3010 ER AH N | |
-0.3010 EY P </s> | |
-0.3010 G R EY | |
-0.3010 GRAPE G R | |
-0.3010 M AE N | |
-0.3010 MANDARIN M AE | |
-0.3010 N AE N | |
-0.3010 N AH </s> | |
-0.3010 N D ER | |
-0.3010 N JH </s> | |
-0.3010 ORANGE AO R | |
-0.3010 P AH L | |
-0.3010 P EH R | |
-0.3010 PEAR P EH | |
-0.3010 R AH N | |
-0.3010 R EY P | |
\end\ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment