-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sergejey/master
Voice/Proximity activation, remote actions
- Loading branch information
Showing
25 changed files
with
109,388 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
This file contains 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
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
умный uu m n ay j | ||
дом d oo m | ||
проснись p r a s nn ii ss | ||
вставай v s t a v aa j |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-alpha 0.97 | ||
-dither yes | ||
-doublebw no | ||
-nfilt 40 | ||
-ncep 13 | ||
-lowerf 133.33334 | ||
-upperf 6855.4976 | ||
-nfft 512 | ||
-wlen 0.0256 | ||
-transform legacy | ||
-feat 1s_c_d_dd | ||
-agc none | ||
-cmn current | ||
-varnorm no | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<s> SIL | ||
</s> SIL | ||
<sil> SIL | ||
- SIL |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<lint> | ||
</lint> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* Copyright 2012, Institute of Cybernetics at Tallinn University of Technology | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.example.recognizer; | ||
|
||
import android.os.Environment; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
public class DataFiles { | ||
|
||
private static final int VERSION = 1; | ||
|
||
private final int mSampleRateInHz; | ||
|
||
private final File mFileHmm; | ||
private final File mFileJsgf; | ||
private final File mFileDict; | ||
private final File mFileLog; | ||
private final File mDirRawLog; | ||
|
||
public DataFiles(String packageName, String lang) { | ||
this(packageName, lang, 16000); | ||
} | ||
|
||
public DataFiles(String packageName, String lang, int sampleRate) { | ||
String baseDirAsString = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/" + lang + "/" + VERSION; | ||
|
||
mFileHmm = new File(baseDirAsString +"/hmm/" + sampleRate); | ||
mFileJsgf = new File(baseDirAsString + "/lm/" + "lm.jsgf"); | ||
mFileDict = new File(baseDirAsString + "/lm/" + "lm.dic"); | ||
mFileLog = new File(baseDirAsString + "/pocketsphinx.log"); | ||
mDirRawLog = new File(baseDirAsString + "/raw/"); | ||
mSampleRateInHz = sampleRate; | ||
} | ||
|
||
public boolean deleteDict() { | ||
return mFileDict.delete(); | ||
} | ||
|
||
public boolean deleteLogfile() { | ||
return mFileLog.delete(); | ||
} | ||
|
||
public boolean deleteJsgf() { | ||
return mFileJsgf.delete(); | ||
} | ||
|
||
public boolean deleteRawLogDir() { | ||
try { | ||
FileUtils.cleanDirectory(mDirRawLog); | ||
} catch (IOException e) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public boolean createRawLogDir() { | ||
if (! mDirRawLog.exists()) { | ||
try { | ||
FileUtils.forceMkdir(mDirRawLog); | ||
} catch (IOException e) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
public String getLogfile() { | ||
return mFileLog.getAbsolutePath(); | ||
} | ||
|
||
public String getRawLogDir() { | ||
return mDirRawLog.getAbsolutePath(); | ||
} | ||
|
||
public String getHmm() { | ||
return mFileHmm.getAbsolutePath(); | ||
} | ||
|
||
public String getDict() { | ||
return mFileDict.getAbsolutePath(); | ||
} | ||
|
||
public String getJsgf() { | ||
return mFileJsgf.getAbsolutePath(); | ||
} | ||
|
||
public int getSampleRateInHz() { | ||
return mSampleRateInHz; | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2012, Institute of Cybernetics at Tallinn University of Technology | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.example.recognizer; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class Dict { | ||
|
||
private final StringBuilder mDict = new StringBuilder(); | ||
private final Set<String> mWords = new HashSet<String>(); | ||
|
||
private static final String NL = System.getProperty("line.separator"); | ||
|
||
public void add(String key, String value) { | ||
if (! mWords.contains(key)) { | ||
mDict.append(key); | ||
mDict.append(" "); // two spaces | ||
mDict.append(value); | ||
mDict.append(NL); | ||
mWords.add(key); | ||
} | ||
} | ||
|
||
public String toString() { | ||
return mDict.toString(); | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.example.recognizer; | ||
|
||
public class Grammar { | ||
|
||
private final String mJsgf; | ||
private final Dict mDict; | ||
private final PhonMapper mPhonMapper; | ||
|
||
public Grammar(String[] commands, PhonMapper phonMapper) { | ||
mDict = new Dict(); | ||
mPhonMapper = phonMapper; | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
sb.append("#JSGF V1.0;\ngrammar commands;\n"); | ||
sb.append("public <command> = <commands>+;\n"); | ||
sb.append("<commands> = "); | ||
|
||
for (int i = 0; i < commands.length; i++) { | ||
String command = commands[i]; | ||
addWords(command); | ||
if (i > 0) sb.append(" | "); | ||
sb.append("[").append(command).append("]"); | ||
} | ||
|
||
sb.append(";\n"); | ||
mJsgf = sb.toString(); | ||
} | ||
|
||
public String getJsgf() { | ||
return mJsgf; | ||
} | ||
|
||
public String getDict() { | ||
return mDict.toString(); | ||
} | ||
|
||
public void addWords(String text) { | ||
String[] words = text.split(" "); | ||
for (String word : words) { | ||
mDict.add(word, mPhonMapper.getPronoun(word)); | ||
} | ||
} | ||
} |
Oops, something went wrong.