Package org.corrib.jonto.wordnet

Examples of org.corrib.jonto.wordnet.WordNetContext


    KOSEntry keyword = null;

    List<KOSEntry> results = new ArrayList<KOSEntry>();
    String out = "";
    try {
      WordNetContext word = WordNetContext.getContext();

      results.addAll(ThesaurusStorage.getInstance().search(word, "label:" + value + " AND (type:synset OR type:tag)"));
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here


    if (meaning == null) {
     
     
      try {
       
        WordNetContext word =WordNetContext.getContext();
   //      results.addAll(ThesaurusStorage.getInstance().search(word,  "label:"+value));
        results.addAll(ThesaurusStorage.getInstance().search(word,  "label:"+value+" AND (type:synset OR type:tag)"));
        for(KOSEntry result2 : results)
        {
          Synset newmeaning = new Synset(word,result2.getURI(),null);
View Full Code Here

    Map<Synset, String> temp = new HashMap<Synset, String>(); //used to check whether given pair of: Synset -> lema is already in the qpe
    try{
      /*
       * this adds WordNet word definition meanings to the query
       */
      WordNetContext wordcontext =WordNetContext.getContext();
      Collection<ThesaurusEntry> ttempsens = new HashSet<ThesaurusEntry>();
     
      for(Synset sens : entryMeanings){
        //for (ThesaurusEntry word : sens.getWordSenses()){
          Synset tempword = new Synset(wordcontext, sens.getURI(),null);
          if(!temp.containsKey(tempword)){
            QueryParameterEntry newqpe = new QueryParameterEntryImpl(sens.getLabel());
           
           
            newqpe.setMeaning(tempword);
            newqpe.setRanking((rank == 0 ) ? m2resource.wordnetBoost : m2resource.wordnetBoost * rank);
            ////logger.info("wynik33"+newqpe.getMeaning().getGlossaryDescription()+ " rank: " + newqpe.getRanking());
            if (newqpe.getMeaning()!=qpe.getMeaning())
            {
            result.add(newqpe);
            temp.put(tempword, sens.getLabel());
            }
          }else if (!temp.get(tempword).equals(sens.getLabel())){
            QueryParameterEntry newqpe = new QueryParameterEntryImpl(sens.getLabel());
           
           
            newqpe.setMeaning(tempword);
            newqpe.setRanking((rank == 0 ) ? m2resource.wordnetBoost : m2resource.wordnetBoost * rank);
            ////logger.info("wynik33"+newqpe.getMeaning().getGlossaryDescription() + " rank: " + newqpe.getRanking());
            if (newqpe.getMeaning()!=qpe.getMeaning())
            {
            result.add(newqpe);
            temp.put(tempword, sens.getLabel());
            }
          }
         
//        }
        //extend each meaning with some *NYM
//        targets.addAll(new ExpandSynset(sens).getTargets(pointer));
        //Synset tempword2 = new Synset(wordcontext, sens.getURI());
        //ttempsens.addAll(tempword2.getAntonyms());
        //sens.getAntonyms();
       
        try{
         
         
         
         
         
        if(precise)
        {
         
          if((Configuration.PrecisionAntonyms))
          {
          ttempsens.addAll(sens.getAntonyms()); //No sense ?
          }
          if((Configuration.PrecisionHypernyms))
          {
          ttempsens.addAll(sens.getHypernyms());
          }
          if((Configuration.PrecisionHyponyms))
          {
          ttempsens.addAll(sens.getHyponyms());
          }
          if((Configuration.PrecisionSynonyms))
          {
          ttempsens.addAll(sens.getSynonyms());
          }
        }
        else
        {
          if((Configuration.RecallAntonyms))
          {
          ttempsens.addAll(sens.getAntonyms()); //No sense ?
          }
          if((Configuration.RecallHypernyms))
          {
          ttempsens.addAll(sens.getHypernyms());
          }
          if((Configuration.RecallHyponyms))
          {
          ttempsens.addAll(sens.getHyponyms());
          }
          if((Configuration.RecallSynonyms))
          {
          ttempsens.addAll(sens.getSynonyms());
          }
       
        }
        }catch (Exception e){
          //logger.severe("Can not expand meanings with some *NYMs");
        }
       
        Collection<Synset> tempsens = new HashSet<Synset>();
        for(ThesaurusEntry tt : ttempsens)
        {

          tempsens.add(new Synset (wordcontext, tt.getURI(), null));
         
        }
        targets.addAll(tempsens);
       
         
      }
     
//    }catch (JWNLException e){
//      //logger.severe("Error getting expanded synset for meaning");
    }catch (Exception e){
      //logger.severe("Problems with getting expanded synset for meaning :  "+e);
    }
   
    /*
     * add *NYM synsets to the query
     */
   
    WordNetContext wordcontext;
    try {
      wordcontext = WordNetContext.getContext();
   
    for(Synset newSynset: targets){
//      for(ThesaurusEntry word : newSynset.getWordSenses()){
View Full Code Here

   
    List<KOSEntry> results = new ArrayList<KOSEntry>();
     //for(ThesaurusContext context : Thesauri.getInstance().getContexts())
   
      try {
        WordNetContext word =WordNetContext.getContext();
        results.addAll(ThesaurusStorage.getInstance().search(word,  "label:"+statement.getObject().toString()+" AND (type:synset OR type:tag)"));
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
View Full Code Here

TOP

Related Classes of org.corrib.jonto.wordnet.WordNetContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.