Hyponym of person or not?

Help
MAB_71
2005-07-08
2013-04-29
  • MAB_71

    MAB_71 - 2005-07-08

    I need a method:

    public static boolean hypernymOfPerson (String noun)

    ...to determine if the noun provided is a hyponym of person or not.

    Has anyone made such a method? If not, can anyone give me a hint on how to extract that particular information from the pointerTargetTree object?

    Any help greatly appreciated!

     
    • MAB_71

      MAB_71 - 2005-07-09

      Hacked it. This piece of code seems to work:

      public boolean hyponymOfPerson (String str)
          {
              boolean isPerson = false;
              int senses;
             
              try
              {
                  word1 = Dictionary.getInstance().lookupIndexWord(POS.NOUN, "person");
                  word2 = Dictionary.getInstance().lookupIndexWord(POS.NOUN, str);
                 
                  // Find out how many senses there are of the supplied word:
                  try
                  {   
                      synset= word2.getSenses();
                      senses = synset.length;
                      //System.out.println ("There are " + senses + " senses of the word \"" + str + "\" (noun) :" );
                  }
                 
                  catch (Exception ex)
                  {
                      return false; // The word doesn't appear in the dictionary
                  }
                 
                  sense = PointerUtils.getInstance().getHypernymTree(word2.getSense(1));
                  System.out.println ("Sense: " + sense + " class: " + sense.getClass());

                  if (sense.findFirst((PointerTarget) word1.getSense(1)) == null)
                  {
                      isPerson = false;
                  }
                 
                  else
                  {               
                      isPerson = true;
                  }                    
              }

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks