Topic locked

add wordlist using java eclipse

March 3, 2014 - 6:54pm #1

add wordlist using java eclipse

March 10, 2014 - 2:55am #8

Great.

 

add wordlist using java eclipse

March 9, 2014 - 7:17pm #7
Hi!
Thank you very much AlessandroB.
 
Its working now!

add wordlist using java eclipse

March 9, 2014 - 11:24am #6

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.

 

add wordlist using java eclipse

March 8, 2014 - 4:28am #5

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

AttachmentSize
Package icon myWords.zip6.45 KB

add wordlist using java eclipse

March 5, 2014 - 4:23am #4

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

March 5, 2014 - 2:20am #3
I did already and follow the rules as a sample(.lst), and it still doesnt work, . .
 
I uploaded the file .lst and the directory screen shoot, may You chek it, thanks in advance
 
 
AttachmentSize
Image icon screen.jpg206.36 KB

add wordlist using java eclipse

March 4, 2014 - 4:07am #2

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:

UTF-8
 
Then, each word must be located in a row, separated from the following by a line feed character (“\n”, ASCII code: 0x0A)
as explained here:
 
To verify that your code successfully loads an lst you may want to first try with the sample word list provided here:
 
 
Topic locked