Xamarin 的袖珍狮身人面像 Android

Pocket Sphinx for Xamarin Android

我试图在 pocketsphinx 上对其语音识别功能进行 Java 绑定(我使用了 aar 方法),看来我成功完成了 Java 绑定部分(没有错误),但是在我调用之后它崩溃了:

 Assets assets = new Assets(this);
 File assetDir = assets.SyncAssets();
 SpeechRecognizer recognizer = SpeechRecognizerSetup.DefaultSetup().SetAcousticModel(new File(assetsDir,"sync/en-us-ptm")).SetKeywordThreshold(1e-20f).SetDictionary(new Java.IO.File(assetsDir,"sync/cmudict-en-us.dict")).Recognizer;
 recognizer.AddListener(this);

我已经发现错误在线:

 File assetDir = assets.SyncAssets();

SyncAssets() 方法需要 Assets.lst。我如何自动生成 Assets.lst 就像在: PocketSphinx for Android tutorial 或者有人有任何其他有效的 java 绑定方法吗?

谢谢

所以我尝试了几种方法,一种对我有用的方法是:

  1. 安装Android Studio 和SDK

  2. 在 Android Studio

  3. 上打开 pocketsphinx 演示项目
  4. 确保 pocketsphinx 的所有资产文件夹名称和路径相同
  5. 建造!
  6. assets.lst 和 .md5 文件(针对每个文件)由 Android Studio
  7. 生成
  8. 将这些文件复制到 visual studio 项目
  9. 完成!

而且我创建识别器的方法也是错误的。应该是:

SpeechRecognizerSetup.DefaultSetup().SetAcousticModel(new File(assetDir,"en-us-ptm")).SetKeywordThreshold(1e-20f).SetDictionary(new Java.IO.File(assetDir,"cmudict-en-us.dict")).Recognizer;

(不同步/)

特别说明: 您必须将 pocketsphinx 的所有资产放在同步文件夹中 Click to see the Image