- Sort Posts
- 7 replies
- Last post
add wordlist using java eclipse
Attachment | Size |
---|---|
![]() | 206.36 KB |
add wordlist using java eclipse
The sample lst file should work flawlessly, provided that the App can find and load the file at the specififed location;
I would suggest to check the returned integer value of the function to load the additional words from file, and check that it greater than zero:
From the wordList class reference, you can read:
Loads a set of custom words from a plain text file
The word list is extended with the custom words in the plain text file.
Each word must be between 2-45 characters in length. Returns the
number of loaded custom words. The text file shall be encoded in UTF-8.
If path is NULL the return value is -1.
If you get 0 or -1, this may indicate that the loading failed.
add wordlist using java eclipse
Hi, I had a same problem with TextReco using Java Eclipse.
Its different from tutorial here: https://developer.vuforia.com/resources/dev-guide/text-recognition-feature
and the code from sample code: VuforiaSamples-2-8-8.
I tried the code, and looks like my code the same with zalfie1986, It works too, but no additional words when i run the app.
This is my additional codes for add words (*.lst) file.
@Override public boolean doLoadTrackersData() { TrackerManager tm = TrackerManager.getInstance(); TextTracker tt = (TextTracker) tm .getTracker(TextTracker.getClassType()); WordList wl = tt.getWordList(); //WordList wln = tt.getWordList(); return wl.loadWordList("TextReco/Vuforia-English-word.vwl", WordList.STORAGE_TYPE.STORAGE_APPRESOURCE); } public int addWordsFromFile(String path, int storageType) { TrackerManager tmn = TrackerManager.getInstance(); TextTracker tts = (TextTracker) tmn .getTracker(TextTracker.getClassType()); WordList wl = tts.getWordList(); return wl.addWordsFromFile("TextReco/myWords.lst", WordList.STORAGE_TYPE.STORAGE_APPRESOURCE); }
I attached my TextReco.java
and my_word.lst
I'm doing this for 3 weeks, but still no progress. . Please help me.
Thanks
Attachment | Size |
---|---|
![]() | 6.45 KB |
add wordlist using java eclipse
Here is the code that I have tried and verified that works:
@Override public boolean doLoadTrackersData() { TrackerManager tm = TrackerManager.getInstance(); TextTracker tt = (TextTracker) tm .getTracker(TextTracker.getClassType()); WordList wl = tt.getWordList(); boolean loaded = wl.loadWordList("TextReco/Vuforia-English-word.vwl", WordList.STORAGE_TYPE.STORAGE_APPRESOURCE); ////////////////////////////////// // Add additional words from file if (loaded) { wl.addWordsFromFile("TextReco/AdditionalWords.lst", WordList.STORAGE_TYPE.STORAGE_APPRESOURCE); } ////////////////////////////////// return loaded; }
Also, make sure to first test with the sample file that you can download here:
https://developer.vuforia.com/sites/default/files/AdditionalWords.zip
And check that your own custom file respect the syntax and formatting rules explained in the dev guide:
https://developer.vuforia.com/resources/dev-guide/word-targets
Hope this helps.
Hi, the code looks correct, but you may want to check the format of your ".lst" file;
in particular, remember that the file is a text file which must start with this line: