adding synset with use count

Help
ashish
2012-11-29
2013-05-23
  • ashish
    ashish
    2012-11-29

    IndexWord WORD;
             WORD = dictionary.getIndexWord(POS.NOUN, "cart");
           
             Word workWord = null;
             List<Synset> l = WORD.getSenses();
             searchB:
             for(Synset s : l)
             {
                 List<Word> pl = s.getWords();
                  for(Word t:pl)
                {
    }
    }

    I want to add another synset of word "cart" as "car" with use count 2.
    How can i achieve it?

     
  • For examples on dictionary editing (including synset creation) you can take a look inside unit tests, for example TestCreateDictionary.java

     
  • ashish
    ashish
    2012-11-30

    Hi Autayeu,

    Thank you for quick reply and consideration. I am checking Test*.java files.
    Meanwhile It is possible that I implementing wrong way but i wanted to set Word.setCount but after saving dictionary Word.getCount is zero.
    Could you please review the following code in order to adding a word car and setCount?
    ---Code starts following
    IndexWord WORD;
             WORD = dictionary.getIndexWord(POS.NOUN, "cart");
             Word workWord = null;
             List<Synset> l = WORD.getSenses();
             searchB:
             for(Synset s : l)
             {
                 List<Word> pl = s.getWords();
                  for(Word t:pl)
                {
                  if(t.getUseCount()>0)
                  {
                  workWord = t;
                  break searchB;
                  }
                 
                }
               }
            
             Word tempWord = new Word(dictionary, workWord.getSynset(), workWord.getSynset().getWords().size() + 1, "car");
             tempWord.setUseCount(Integer.parseInt("10"));

                   
    System.out.println("adding");
             workWord.getSynset().getWords().add(tempWord);
            
             System.out.println("saving");
             dictionary.save();

    Currently I am able to add "car" but setCount remains zero.

    Regards,
    Ashish

     
  • There was a bug in saving use counts. It's fixed, and will be included in the next release. Till the release please use source code from my repo: git://extjwnl.git.sourceforge.net/gitroot/extjwnl/autayeu

     
  • ashish
    ashish
    2012-12-03

    Thanks autayeu new release is working now.