0

I made a new data folder in res folder and place the file left3words-wsj-0-18.tagger inside it and give the path in the MaxentTagger as

MaxentTagger tagger = null;
tagger = new MaxentTagger("data/left3words-wsj-0-18.tagger");

I gave the path data/left3words-wsj-0-18.tagger in constructor. I also edit the app.iml and added this line

sourceFolder url="file://$MODULE_DIR$/src/main/res/data" isTestSource="false" />

But still it giving the error

Loading default properties from trained tagger left3words-wsj-0-18.tagger Error: No such trained tagger config file found. java.io.FileNotFoundException: left3words-wsj-0-18.tagger: open failed: ENOENT (No such file or directory)

user6750923
  • 469
  • 2
  • 11
  • 22

1 Answers1

0

Please read https://developer.android.com/guide/topics/resources/providing-resources.html on what are the accepted folders under the res folder.

Related to your particular case, you can place the file under res/raw folder and you can access it by id (R.raw.left3words_wsj_0_18 - note the automatic conversion from dash to underline, so you might want to just go ahead and change the file name to avoid confusion later on).

Here is an example on how to read a raw resource: Android read text raw resource file

Community
  • 1
  • 1
N.T.
  • 2,601
  • 1
  • 14
  • 20
  • @N. T. Should I add folder in `app.iml` file? – user6750923 Aug 26 '16 at 17:44
  • No, you can add it the same way in which you add the other resources. Either through Android Studio (right click on res folder and choose `Add resource directory` and make sure you choose the type `raw`) or through your file explorer (just create folder and add the file there) – N.T. Aug 26 '16 at 17:48