Examples of Lemma


Examples of gannuNLP.data.Lemma

  public Sense getSense(String sid)throws Exception
  {
    if(!this.isWeb)
    {
      String lemma=sid.split("@")[0];
      Lemma l=this.getLemmaNoModifiers(lemma);
      if(sid.split("@").length>1)
      {
        int senseNumber=Integer.parseInt(sid.split("@")[1]);
        return l.getSenses().get(senseNumber);
      }
      else
        return null;
    }
    else
View Full Code Here

Examples of gannuNLP.data.Lemma

    }

  @Override
  public Lemma getLemma(String lemma) throws Exception {
        ArrayList<Sense> s=this.getSenses(lemma);
        Lemma l=null;
        if(s.size()>0)
           l=new Lemma(lemma,s.get(0).getPos(),s,this.getCounts(lemma),this.name);
    return l;
  }
View Full Code Here

Examples of gannuNLP.data.Lemma

   * @throws Exception
   */
  public static void readLemma(DataBroker dic,String lemma,Element word,String pos)throws Exception
  {
    String lem=lemma+"_"+pos;
    Lemma l=null;
    ArrayList<Sense> senses=dic.getSenses(lem);
    BufferedReader kb = new BufferedReader(new InputStreamReader(System.in));
    if(senses.size()==0)//
    {
      if(!SemCorCleaner.fix)
      {
        System.out.println("Lemma not found: "+lem);
        System.out.println("Please enter a lemma or no for ignoring this word!");
        String plemma=kb.readLine();
        if(plemma.equals("no"))
        {
          word.setAttribute("cmd","ignore");
        }
        else
        {
          l=dic.getLemma(plemma);
          while(l==null)
          {
            System.out.println("Please write the valid form (lemma_P where lemma is in normal form and P is the first letter of the pos tag)");
            plemma=kb.readLine();
            l=dic.getLemma(plemma);
          }       
          word.setAttribute("lemma",l.getLemma().substring(0,l.getLemma().length()-2));
          word.setAttribute("pos",l.getPos());
          word.setAttribute("wnsn","-1");
        }
      }
      else
      {
        System.out.println("Marking "+word.getValue()+" for future tagging ");
        word.setAttribute("cmd","tag");
      }
    }
    else
    {
      System.out.println("\n<"+word.getValue()+"> may not be in normal form");
      ArrayList<String> morphs=dic.Morphy(lemma, pos);
      do
      {     
        String plemma;
        if(morphs.size()==1)
        {
          plemma=morphs.get(0)+"_"+pos;
          System.out.println(lemma+" was autocorrected to "+ plemma);
        }
        else
        {
          if(!SemCorCleaner.fix)
          {
            System.out.println("Please select the valid form (lemma_P where lemma is in normal form and P is the first letter of the pos tag).\nSome suggestions are "+morphs+" just remember to add the _"+pos+" pos tagat the end of the lemma");
            plemma=kb.readLine();
          }
          else
          {
            System.out.println("Marking "+word.getValue()+" for future tagging ");
            word.setAttribute("cmd","tag");
            break;
          }
        }
        l=dic.getLemma(plemma);
      }
      while(l==null&&!SemCorCleaner.fix);
      if(l!=null)
      {
        word.setAttribute("lemma",l.getLemma().substring(0,l.getLemma().length()-2));
        word.setAttribute("pos",l.getPos());
        word.setAttribute("wnsn","-1");
      }
    }
  }
View Full Code Here

Examples of gannuNLP.data.Lemma

            if((word.getAttribute("cmd").getValue().equals("done"))||(tag&&(word.getAttribute("cmd").getValue().equals("tag"))))
            {
              String lemma=word.getValue();
              String pos=word.getAttribute("pos").getValue().substring(0,1);
              String lem;
              Lemma l=null;
              if(word.getAttribute("cmd").getValue().equals("done"))
                { 
                if(word.getAttribute("lemma")!=null)
                {
                  lemma=word.getAttribute("lemma").getValue();
                    pos=word.getAttribute("pos").getValue().substring(0,1);
                    lem=lemma+"_"+pos;
                    l=dic.getLemma(lem);                 
                }
                else
                {
                  lemma="";
                  pos="X";
                }
                }
              lem=lemma+"_"+pos;
 
             
              if(l==null)//lemma may not be in normal form
              {
               
                SemCorCleaner.displayWindow(words, w);
                SemCorCleaner.readLemma(dic, lemma, word, pos);
                l=dic.getLemma(word.getAttributeValue("lemma")+"_"+word.getAttributeValue("pos").substring(0,1));
              }
              if(l!=null)
              {
                if(!SemCorCleaner.isValidWNSN(word.getAttributeValue("wnsn"), l.getSenses().size()))
                {
                  SemCorCleaner.displayWindow(words, w);
                  SemCorCleaner.checkSenses(word, l);
                }
              }
View Full Code Here

Examples of gannuNLP.data.Lemma

          w.setDict(data);
          data.addModifier(w);
        }
      }
      data.load("all");
      Lemma l=data.getLemma(args[2]);
      if(l!=null)
      {
        System.out.println("Have "+l.getSenses().size()+" senses");
        System.out.println("Frequency: "+String.valueOf(l.getFrequency()));
        System.out.println("IDF: "+data.getIDF(l));
        for(Sense s:l.getSenses())
        {
          System.out.println(s.getSid());
          System.out.println(s.getSynonyms());       
          for(int i=0;i<s.getSamples().size();i++)
          {
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.Lemma

      String form = lemmaStrItr.next();
      Set<?> posTagSet = lemmaMap.get(form);
      Iterator<?> posTagItr = posTagSet.iterator();
      while (posTagItr.hasNext()) {
        String pos = (String) posTagItr.next(); // part of speech
        Lemma lemma = new Lemma(jcas);
        lemma.setKey(form);
        lemma.setPosTag(pos);
        lemmas.add(lemma);
      }
    }
    Lemma[] lemmaArray = lemmas.toArray(new Lemma[lemmas.size()]);
    FSList fsList = ListFactory.buildList(jcas, lemmaArray);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.Lemma

      String form = (String) lemmaStrItr.next();
      Set posTagSet = (Set) lemmaMap.get(form);
      Iterator posTagItr = posTagSet.iterator();
      while (posTagItr.hasNext()) {
        String pos = (String) posTagItr.next(); // part of speech
        Lemma lemma = new Lemma(jcas);
        lemma.setKey(form);
        lemma.setPosTag(pos);
        lemmas.add(lemma);
      }
    }
    Lemma[] lemmaArray = (Lemma[]) lemmas.toArray(new Lemma[lemmas.size()]);
    FSList fsList = ListFactory.buildList(jcas, lemmaArray);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.Lemma

      String form = (String) lemmaStrItr.next();
      Set posTagSet = (Set) lemmaMap.get(form);
      Iterator posTagItr = posTagSet.iterator();
      while (posTagItr.hasNext()) {
        String pos = (String) posTagItr.next(); // part of speech
        Lemma lemma = new Lemma(jcas);
        lemma.setKey(form);
        lemma.setPosTag(pos);
        lemmas.add(lemma);
      }
    }
    Lemma[] lemmaArray = (Lemma[]) lemmas.toArray(new Lemma[lemmas.size()]);
    FSList fsList = ListFactory.buildList(jcas, lemmaArray);
View Full Code Here

Examples of synalp.commons.input.Lemma

    this.noAdjunction = node.isNoAdjunction();
    this.phonE = node.isPhonE();
    this.fsTop = new FeatureStructure(node.getFsTop());
    this.fsBot = new FeatureStructure(node.getFsBot());
    if (node.getAnchorLemma() != null)
      this.anchor = new Lemma(node.getAnchorLemma());
    for(Node child : node.getChildren())
      children.add(new Node(child, this));
  }
View Full Code Here

Examples of synalp.commons.input.Lemma

    node.setNoAdjunction(true);

    // the anchor lemma of the parent is the category of the child node, we take here the first value of the category if it exists
    if (node.getCategory() != null && !node.getCategory().getValues().isEmpty())
    {
      node.setAnchorLemma(new Lemma(node.getCategory().getFirstValue()), true);
      node.getFsTop().addConstantFeature("lemma", node.getCategory());
      node.getFsBot().addConstantFeature("lemma", node.getCategory());
    }

    if (node.getParent() != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.