failed to init recognizer java.io.FileNotFoundException sync/assets.lst - pocketsphinx

时间:2016-09-14 06:41:23

标签: android pocketsphinx

I want to use pocketsphinx.

when I run my model I got this error :

failed to init recognizer java.io.FileNotFoundException sync/assets.lst

but inside my asset there isn't this file (assets.lst):

enter image description here

I don't understand this section of article :

http://cmusphinx.sourceforge.net/wiki/tutorialandroid#including_resource_files

Copy app/asset.xml build file from demo application into your application into same folder app.
Edit app/build.gradle build file to run assets.xml, just as in android demo:

I'm using android studio and I have not app directory in my model .

2 个答案:

答案 0 :(得分:0)

请按照以下步骤操作:

  1. sync
  2. 上创建名为app/src/main/assets的文件夹
  3. 将您创建的语言模型(https://cmusphinx.github.io/wiki/tutoriallm/)或位于:models/src/main/assets/sync的演示项目中同步文件夹的所有内容复制到项目第一步中创建的文件夹中。< / p>

  4. 将以下行添加到app/build.gradle

    ant.importBuild 'assets.xml' preBuild.dependsOn(list, checksum) clean.dependsOn(clean_assets)

  5. 同步您的gradle并使用演示

  6. 提供的代码运行您的项目

答案 1 :(得分:0)

I resolved this by manually cleaning up /HelloWorld/app/build.gradle to include all dependencies. File is,

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "net.blepsias.speakeasy"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
}
}
dependencies {
implementation project(':pocketsphinx')
implementation project(':models')
implementation 'com.android.support:appcompat-v7:26.1.0'
}

The previous file that was causing the failed-to-init error was generated by Android Studio had other stuff and was missing the pocketsphinx.aar reference. Lots of ways to skin this cat most likely...