Package gannuUtil

Examples of gannuUtil.KeyString


    BufferedReader in=new BufferedReader(input);
    String line=in.readLine();
    while(line!=null)
    {
      String tokens[]=line.split("\\|");
      int index=wordCounts.indexOf(new KeyString(tokens[0]));
      if(index>=0)
      {
        KeyString ks=wordCounts.get(index);
        ks.setString(String.valueOf(Integer.parseInt(ks.getString())+Integer.parseInt(tokens[1])));
      }
      else
        wordCounts.add(new KeyString(tokens[0],tokens[1]));
      line=in.readLine();
    }
    in.close();
   
  }
View Full Code Here


          outline=outline.substring(0, outline.length()-1);
          outs.write(outline+"\n");
        }
        for(String lemma:lemmas)
        {
          KeyString ks=new KeyString(lemma,"1");
          int index=counts.indexOf(ks);
          if(index>=0)
          {
            ks=counts.get(index);
            ks.setString(String.valueOf(Integer.parseInt(ks.getString())+1));
          }
          else
          {
            counts.add(ks);
          }
        }
      }
    }
    for(KeyString ks:counts)
    {
      outc.write(ks.getKey()+"|"+ks.getString()+"\n")
    }
    outs.close();
    outc.close();
    writers.close();
    writerc.close();
View Full Code Here

    while(!(line==null))
    {
      tokens=line.split(" ");
      for(j=2;j<tokens.length;j++)
        tokens[1]+=";"+tokens[j];
      exceptions.add(new KeyString(tokens[0]+pos,tokens[1]))
      line=in.readLine();
    }
    in.close();
    inf.close();
    i++;
View Full Code Here

    String aux[]=string.split(";");
    for(String param:aux)
    {
      String x[]=param.split(":");
      if(x.length>1)
        this.params.add(new KeyString(x[0],x[1]));
    }

  }
View Full Code Here

    this.params.clear();
    for(String param:aux)
    {
      String x[]=param.split(":");
      if(x.length>1)
        this.params.add(new KeyString(x[0],x[1]));
    }

  }
View Full Code Here

   * @param Key The desired parameter.
   * @return The value of the specified parameter.
   */
  public String getValue(String Key)
  {
    int index=this.params.indexOf(new KeyString(Key));
    if(index>=0)
      return this.params.get(index).getString();
    else
      return null;
  }
View Full Code Here

      }
     
      Sense s=new Sense(sense,c);
      s.setSid(sense.getSynonyms().get(j)+"@"+String.valueOf(i));
      newlist.add(s);
      equivalents.add(new KeyString(sense.getSid(),s.getSid()));
    }
    Collections.sort(newlist);
    Collections.sort(equivalents);
    this.senses=null;
    this.senses=newlist;
    for(KeyArray k:this.senseMaps)
    {
      for(int j=0;j<k.getArray().size();j++)
      {
        int index=Collections.binarySearch(equivalents, new KeyString(k.getArray().get(j)));
        k.getArray().set(j, equivalents.get(index).getString());
      }
    }
  }
View Full Code Here

          for(ArrayList<String> lemmas:parsedGloss)
            for(String lemma:lemmas)
            {
              //String lemma=lemmas.get(0);
              lineout+=lemma+" ";
              int j=gcounts.indexOf(new KeyString(lemma));
              if(j<0)
              {
                gcounts.add(new KeyString(lemma,"1"));
              }
              else
              {
                KeyString ks=gcounts.get(j);
                ks.setString(String.valueOf(Integer.parseInt(ks.getString())+1));
              }
            }
         
          lineout=lineout.substring(0,lineout.length()-1)+"\n";
          outg.write(lineout);
          for(int k=1;k<samples.length;k++)
          {
            if(samples[k].split(" ").length>2)
            {
              String sample=samples[k];
              lineout=sid+"|"+sample+"|";
              ArrayList<ArrayList<String>> parsedSample=lemmatize(sample);
              for(ArrayList<String> lemmas:parsedSample)
                for(String lemma:lemmas)
                {
                  lineout+=lemma+" ";
                  int j=scounts.indexOf(new KeyString(lemma));
                  if(j<0)
                  {
                    scounts.add(new KeyString(lemma,"1"));
                  }
                  else
                  {
                    KeyString ks=scounts.get(j);
                    ks.setString(String.valueOf(Integer.parseInt(ks.getString())+1));
                  }
                }
              lineout=lineout.substring(0,lineout.length()-1)+"\n";
              outs.write(lineout);
            }
          }
          //Parsing the gloss or the samples
        }
        line=in.readLine()
      }
      in.close();
      inf.close();
      i++;
    }
    for(KeyString ks:gcounts)
    {
      outcg.write(ks.getKey()+"|"+ks.getString()+"\n");
    }
    for(KeyString ks:scounts)
    {
      outcs.write(ks.getKey()+"|"+ks.getString()+"\n");
    }
    outcg.close();
    outcs.close();
    writecs.close();
    writecg.close();
View Full Code Here

   
    for(WindowFilter filter:this.algorithm.getWindowFilters())
    {
      filter.setParentWSD(algorithm);
    }
    this.algorithm.setParameters(this.configurations.get(this.configurations.indexOf(new KeyString("wsd"))).getString());
    if(this.tie!=null)
    {
      for(WindowFilter filter:this.tie.getWindowFilters())
      {
        filter.setParentWSD(tie);
      }
      int index=this.configurations.indexOf(new KeyString("tie"));
      if(index>=0)
        this.tie.setParameters(this.configurations.get(index).getString());
    }
    if(this.backoff!=null)
    {
      for(WindowFilter filter:this.backoff.getWindowFilters())
      {
        filter.setParentWSD(backoff);
      }
      int index=this.configurations.indexOf(new KeyString("backoff"));
      if(index>=0)
        this.backoff.setParameters(this.configurations.get(index).getString());
    }
    out.write("Test of algorithm "+this.algorithm
        + " with backoff "+this.backoff
View Full Code Here

    {
      for(AmbiguousWord word:in.getAmbiguousWords())
      {
        if(word.getSenses().size()>0)
        {
          KeyString aux=new KeyString(word.getLemma(),String.valueOf(word.getIDF()));
          if(!target.contains(aux))
          {
            target.add(aux);
          }
        }
      }
    }
    Dictionary dict=tests.get(0).getDictionary();
    for(Test test:tests)
    {
      for(Summary s:test.getSummaries())
      {
        for(Decision d:s.getDecisions())
        {
          for(int sense=0;sense<d.getSenseCount();sense++)
          {
            for(String word:d.getDecisionWords(sense))
            {
              KeyString aux=new KeyString(word);
              if(!target.contains(aux))
              {
                target.add(new KeyString(word,String.valueOf(dict.getIDF(word))));
              }
            }
          }
        }
      }
View Full Code Here

TOP

Related Classes of gannuUtil.KeyString

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.