我想通過說「你好,傑克」來喚醒Android APP中的某些功能。據我所知,有一種名爲「短語識別」的技術來識別特定的語音,例如, 「你好,傑克」。但我不知道要實施「詞組察覺」。如何在Android上獲得語音喚醒
任何人有更多的想法或建議嗎?
謝謝。
我想通過說「你好,傑克」來喚醒Android APP中的某些功能。據我所知,有一種名爲「短語識別」的技術來識別特定的語音,例如, 「你好,傑克」。但我不知道要實施「詞組察覺」。如何在Android上獲得語音喚醒
任何人有更多的想法或建議嗎?
謝謝。
的simpliest和資源有效的方式是實現動態時間規整DTW關鍵字察覺
http://en.wikipedia.org/wiki/Dynamic_time_warping
http://www.purduecal.edu/ece/WSEAS.pdf
您可以使用CMUSphinx工具來提取MFCC特徵,這將節省很多時間實施它們
我首先提出這個簡單的方法。
開始使用簡單的設置來匹配你想要的,如下面的類的關鍵字:如果失敗介紹
@Override
protected void
onActivityResult(int requestCode, int resultCode, Intent data)
{
WordMatcher matchHello = new WordMatcher("hello");
WordMatcher matchJack = new WordMatcher("jack");
if (requestCode == VOICE_RECOGNITION_REQUEST_CODE)
{
if (resultCode == RESULT_OK)
{
List<String> heard =
data.
getStringArrayListExtra
(RecognizerIntent.EXTRA_RESULTS);
for (String oneResult : heard)
{
if (matchHello.isIn(oneResult.split(" ")) && matchJack.isIn(oneResult.split(" "))
{
//SUCCESS!! do something here
}
}
}
else
{
Log.d(TAG, "error code: " + resultCode);
}
}
super.onActivityResult(requestCode, resultCode, data);
}
二:
public class WordMatcher
{
private Set<String> words;
public static final int NOT_IN = -1;
public WordMatcher(String... wordsIn)
{
this(Arrays.asList(wordsIn));
}
public WordMatcher(List<String> wordsIn)
{
//care about order so we can execute isInAt
words = new LinkedHashSet<String>(wordsIn);
}
public Set<String> getWords()
{
return words;
}
public boolean isIn(String word)
{
return words.contains(word);
}
public boolean isIn(String [] wordsIn)
{
boolean wordIn = false;
for (String word : wordsIn)
{
if (isIn(word))
{
wordIn = true;
break;
}
}
return wordIn;
}
過程的識別結果是這樣「聽起來像」匹配算法,如Soundex。
此外,您可能希望直接調查使用SpeechRecognizer類來在後臺運行語音識別,而不是使用生成對話框的RecognizerIntent。
謝謝,這是一個非常有用的答案:) – 2012-03-23 08:35:22