Find Synonyms using Arabic Wordnet in java

870 views Asked by At

I want to find synonyms using Arabic wordnet in java , I see this question before here , I used the same code source , but it didn't worked. Maybe because i'm using Arabic word net ? I found also a lien http://javatutorialandprojects.blogspot.com/2012/10/finding-synonyms-and-hyponyms-for-words.html . I'm getting an error message :

Exception in thread "main" edu.smu.tspell.wordnet.impl.file.RetrievalException: Error opening index file: F:\TPRI2\AWN\lib\index.sense (Le chemin d’accès spécifié est introuvable) This is the code source i used

    package lucene.ri;

import edu.smu.tspell.wordnet.NounSynset;
import edu.smu.tspell.wordnet.Synset;
import edu.smu.tspell.wordnet.SynsetType;
import edu.smu.tspell.wordnet.WordNetDatabase;

public class wordnet 
 {

    public static void main(String args[])
    {
        String a[]=new String[2];
        int j=0;
        while(j<2)
        {
            System.setProperty("wordnet.database.dir", "F:\\TPRI2\\AWN\\lib");
            NounSynset nounSynset;
            NounSynset[] hyponyms;
            WordNetDatabase database = WordNetDatabase.getFileInstance();
            Synset[] synsets = database.getSynsets(a[j], SynsetType.NOUN);
             System.out.println("*********************************************");
            for (int i = 0; i < synsets.length; i++)
                {
            nounSynset = (NounSynset)(synsets[i]);
            hyponyms = nounSynset.getHyponyms();

            System.err.println(nounSynset.getWordForms()[0] +": " + nounSynset.getDefinition() + ") has " + hyponyms.length + " hyponyms");

                }
            j++;
        }
         System.out.println("*********************************************");
    }
1

There are 1 answers

3
GhostCat On BEST ANSWER

The source code you are showing

  System.setProperty("wordnet.database.dir", "F:\\TPRI2\\AWN\\lib");

That means: your code is telling WordNet where to look for things. Thus: are you sure that the index file mentioned in that error message does really exist in that directly.

And as you now figured: that file is not there; well you have to search for it.

Maybe you are lucky and this helps: check if there is a file sense.idx; and if so, rename (or create a copy) as index.sense