Examples of ATable


Examples of edu.umd.hooka.alignment.hmm.ATable

  static public ATable loadATable(Path path, Configuration job) throws IOException {
    org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration(job);
    FileSystem fileSys = FileSystem.get(conf);

    DataInput in = new DataInputStream(new BufferedInputStream(fileSys.open(path)));
    ATable at = new ATable();
    at.readFields(in);

    return at;
  }
View Full Code Here

Examples of edu.umd.hooka.alignment.hmm.ATable

                new BufferedOutputStream(fileSys.create(pathATable)));
            int cond_values = 1;
            if (!hac.isHMMHomogeneous()) {
              cond_values = 100;
            }
            ATable at = new ATable(hac.isHMMHomogeneous(),
                cond_values, 100); at.normalize(); at.write(dos);
                //      System.out.println(at);
                dos.close()
          }
        }
        conf.setOutputKeyClass(IntWritable.class);
View Full Code Here

Examples of edu.umd.hooka.alignment.hmm.ATable

        if (usePServer)
          ttable = new PServerClient(pserveHost, pservePort);
        else
          ttable = new TTable_monolithic_IFAs(
              ttfs, ltp, true);
        ATable atable = loadATable(job.getATablePath(), job);
        if (!useNullWord)
          trainer = new HMM(ttable, atable);
        else
          trainer = new HMM_NullWord(ttable, atable, job.getHMMp0());
      } else
View Full Code Here

Examples of edu.umd.hooka.alignment.hmm.ATable

        v.addTo(counts);
        }
        IndexedFloatArray sum = new IndexedFloatArray(counts, lm);
        pcc.setContent(sum);
      } else {
        ATable sum = null;
        while (values.hasNext()) {
          if (sum == null)
            sum = (ATable)((ATable)values.next().getContent()).clone();
          else
            sum.plusEquals((ATable)values.next().getContent());
        }
        pcc.setContent(sum);
        //        pcc.normalize();
        //        if (true) throw new RuntimeException("CHECK\n"+pcc.getContent());
      }
View Full Code Here

Examples of edu.umd.hooka.alignment.hmm.ATable

            reporter.incrCounter(MergeCounters.EWORDS, 1);
            reporter.incrCounter(MergeCounters.STATISTICS, ((IndexedFloatArray)t.getContent()).size() + 1);
          } else {
            if (emittedATable)
              throw new RuntimeException("Should only have a single ATable!");
            ATable at = (ATable)t.getContent();
            fileSys.delete(atablePath, true);
            DataOutputStream dos = new DataOutputStream(
                new BufferedOutputStream(fileSys.create(atablePath)));
            at.write(dos);
            dos.close();
            emittedATable = true;
          }
        }
        reader.close();
View Full Code Here

Examples of edu.umd.hooka.alignment.hmm.ATable

          reporter.incrCounter(MergeCounters.EWORDS, 1);
          reporter.incrCounter(MergeCounters.STATISTICS, ((IndexedFloatArray)t.getContent()).size() + 1);
        } else {
          if (emittedATable)
            throw new RuntimeException("Should only have a single ATable!");
          ATable at = (ATable)t.getContent();
          fileSys.delete(atablePath, true);
          DataOutputStream dos = new DataOutputStream(
              new BufferedOutputStream(fileSys.create(atablePath)));
          at.write(dos);
          dos.close();
          emittedATable = true;
        }
      }
      fileSys.delete(ttablePath, true); // delete old ttable
View Full Code Here

Examples of edu.umd.hooka.alignment.hmm.ATable

  }

  public void readFields(DataInput in) throws IOException {
    type = in.readByte();
    if (type == CONTENT_ATABLE) {
      content = new ATable();
    } else if (type == CONTENT_ARRAY) {
      content = new IndexedFloatArray();
    }else {
      throw new RuntimeException("Bad content type!");
    }
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.