Package joshua.corpus.alignment.mm

Examples of joshua.corpus.alignment.mm.MemoryMappedAlignmentGrids


    } else if ("AlignmentGrids".equals(alignmentsType) || "AlignmentsGrid".equals(alignmentsType)) {
      if (logger.isLoggable(Level.INFO)) logger.info("Using AlignmentGrids");
      alignments = new AlignmentGrids(new Scanner(new File(alignmentsFileName)), sourceCorpusArray, targetCorpusArray, trainingSize, requireTightSpans);
    } else if ("MemoryMappedAlignmentGrids".equals(alignmentsType)) {
      if (logger.isLoggable(Level.INFO)) logger.info("Using MemoryMappedAlignmentGrids");
      alignments = new MemoryMappedAlignmentGrids(alignmentsFileName, sourceCorpusArray, targetCorpusArray);
    } else {
      alignments = null;
      logger.severe("Invalid alignment type: " + alignmentsType);
      System.exit(-1);
    }
View Full Code Here


    String targetFileName = joshDir + "/target.corpus";
    Corpus targetCorpusArray = new MemoryMappedCorpusArray(commonVocab, targetFileName);
 
    String alignmentFileName = joshDir + "/alignment.grids";
    Alignments alignments = new MemoryMappedAlignmentGrids(alignmentFileName, sourceCorpusArray, targetCorpusArray);
 
    return new AlignedParallelCorpus(sourceCorpusArray, targetCorpusArray, alignments);
  }
View Full Code Here

      File.separator + "alignment.grids";
    if (logger.isLoggable(Level.INFO))
      logger.info("Reading alignment grid data from " +
        binaryAlignmentFileName);
    Alignments alignments =
      new MemoryMappedAlignmentGrids(
          binaryAlignmentFileName,
          sourceCorpusArray,
          targetCorpusArray);
       
    // Finally, add the parallel corpus that will serve as a grammar
View Full Code Here

    if ("AlignmentArray".equals(alignmentsType)) {
      alignments = SuffixArrayFactory.createAlignments(trainAlign_fileName, srcSA, tgtSA);
    } else if ("AlignmentGrids".equals(alignmentsType) || "AlignmentsGrid".equals(alignmentsType)) {
      alignments = new AlignmentGrids(new Scanner(new File(trainAlign_fileName)), srcCorpusArray, tgtCorpusArray, trainingSize, true);
    } else if ("MemoryMappedAlignmentGrids".equals(alignmentsType)) {
      alignments = new MemoryMappedAlignmentGrids(trainAlign_fileName, srcCorpusArray, tgtCorpusArray);
    }



    if (!fileExists(alignCache_fileName)) {
View Full Code Here

         
          logger.fine("Loading target suffix array...");
          Suffixes targetSuffixes = new MemoryMappedSuffixArray(binarySourceSuffixesFileName, sourceCorpus);

          logger.fine("Loading alignment grids...");
          Alignments alignments = new MemoryMappedAlignmentGrids(binaryAlignmentFileName, sourceCorpus, targetCorpus);
         
//          ParallelCorpusGrammarFactory parallelCorpus = new ParallelCorpusGrammarFactory(
//              sourceSuffixes,
//              targetSuffixes,
//              alignments,
View Full Code Here

      ObjectOutput out = new BinaryOut(mmAlignmentFile);
      grids.writeExternal(out);
      out.flush();
      out.close();
     
      alignments = new MemoryMappedAlignmentGrids(mmAlignmentFile.getAbsolutePath(), sourceCorpusArray, targetCorpusArray);
    } else {
      Assert.fail(alignmentsType + " is not a known alignment type.");
    }
   
   
View Full Code Here

TOP

Related Classes of joshua.corpus.alignment.mm.MemoryMappedAlignmentGrids

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.