Package gannuNLP.data

Examples of gannuNLP.data.SuperLemma


    for(KeyArray Key:this.senseMaps)
    {
      String lemma=Key.getKey();
      ArrayList<Sense> senses=this.getSenses(lemma);
      ArrayList<Count> counts=this.getCounts(lemma);
      SuperLemma s=this.loadSuperLemma(lemma,path);
      Lemma lemmaO=new Lemma(lemma,senses.get(0).getPos(),senses,counts,this.name);
      s.addLemma(lemmaO);
      this.WriteSuperLemma(path,s);
      i++;
      if(i%1000==0)
      {
        System.out.println("Saving slm file "+String.valueOf(i)+"/"+String.valueOf(this.senseMaps.size()));
View Full Code Here


   * @return The corresponding SuperLemma if any. Otherwise, it returns a new empty SuperLemma.
   * @throws Exception
   */
  public SuperLemma loadSuperLemma(String lemma,String path) throws Exception{
    File ft=new File(path+Dictionary.normalizeLemmaforFile(lemma)+".slm");
    SuperLemma s;
    if(ft.exists())
    {
      s=(SuperLemma)Util.loadObject(ft);
    }
    else
    {
      s=new SuperLemma(lemma);
    }
    return s;
  }
View Full Code Here

    }
    Collections.sort(updates);
    System.out.println("Saving samples!!!");
    d=1;
    Update p=null;
    SuperLemma s=null;
    Lemma l=null;
    for(Update u:updates)
    {
      System.out.println(String.valueOf(d)+"/"+String.valueOf(updates.size()));
      d++;
      if(p==null||!u.getLemma().equals(p.getLemma()))
      {
        if(s!=null)
        {
          l.addCount(counts.get(lemmas.indexOf(p.getLemma())));
          this.dict.WriteSuperLemma(path, s);
        }
        s=this.dict.loadSuperLemma(u.getLemma(),path);
        l=s.retrieveLemma(this.dict.getName());
      }
      Sense sens=l.getSenses().get(u.getSense());
      if(!sens.getSamples().contains(u.getText()))
      {
        sens.addBagOfWords(u.getText(), u.getBow(),this.name);
View Full Code Here

   */
  public Lemma getLemmaNoModifiers(String lemma)throws Exception
 
    File d=new File("./data/lemmas/"+this.getName()+"/");
    d.mkdirs();
    SuperLemma s=this.loadSuperLemma(lemma,"./data/"+this.getName()+"/");
    Lemma l=null;
    if(s.getLemmas().size()>0)
    {
      l=s.retrieveLemma(this.source.toString());
      if(l!=null)
      {
        l=new Lemma(l,this.sampleSources);                   
      }

    }
    if(l==null&&this.source.isWeb())
    {
      l=this.source.getLemma(lemma);
      if(l!=null)
      {
        s.addLemma(l);
        this.WriteSuperLemma("./data/"+this.getName()+"/",s);
      }
    }
    return l;
  }
View Full Code Here

      File d=new File("./data/lemmas/"+this.getCompleteName().replace(">", "@@@@@@")+"/");     
      d.mkdirs();
      d=new File("./data/lemmas/"+this.getName()+"/");
      d.mkdirs();
    }
    SuperLemma s=this.loadSuperLemma(lemma,"./data/"+this.getName()+"/");
    Lemma l=null;
    if(s.getLemmas().size()>0)
    {
      l=s.retrieveLemma(this.source.toString());
      if(l!=null)
      {
        l=new Lemma(l,this.sampleSources);                   
      }

    }
    if(l==null&&this.source.isWeb())
    {
      l=this.source.getLemma(lemma);
      if(l!=null)
      {
        s.addLemma(l);
        this.WriteSuperLemma("./data/"+this.getName()+"/",s);
      }
    }
    if(l!=null)
    {
View Full Code Here

TOP

Related Classes of gannuNLP.data.SuperLemma

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.