Package joshua.corpus

Examples of joshua.corpus.Span


   
  }
 
  @Test(dependsOnMethods={"setup"})
  public void test() {
    Assert.assertEquals(alignmentArray.getAlignedTargetSpan(0, 1),new Span(0,1));
    Assert.assertEquals(alignmentArray.getAlignedTargetSpan(1, 2),new Span(0,2));
    Assert.assertEquals(alignmentArray.getAlignedTargetSpan(2, 3),new Span(0,3));
    Assert.assertEquals(alignmentArray.getAlignedTargetSpan(3, 4),new Span(0,4));
   
    Assert.assertEquals(alignmentArray.getAlignedSourceSpan(0, 1),new Span(0,4));
    Assert.assertEquals(alignmentArray.getAlignedSourceSpan(1, 2),new Span(1,2));
    Assert.assertEquals(alignmentArray.getAlignedSourceSpan(2, 3),new Span(2,3));
    Assert.assertEquals(alignmentArray.getAlignedSourceSpan(3, 4),new Span(3,4));
  }
View Full Code Here


 
 
  @Test(dependsOnMethods={"setup"})
  public void testGetAlignedTargetSpan() {

    Span targetSpan;
   
    // Sentence 0
    {
      int sourceOffset = sourceCorpusArray.getSentencePosition(0);
      int targetOffset = targetCorpusArray.getSentencePosition(0);
View Full Code Here

 
 
  @Test(dependsOnMethods={"setup"})
  public void testGetAlignedSourceSpan() {
   
    Span sourceSpan;
   
    // Sentence 0
    {
      int sourceOffset = sourceCorpusArray.getSentencePosition(0);
      int targetOffset = targetCorpusArray.getSentencePosition(0);
View Full Code Here

public class SpanTest {

  @Test
  public void iterator() {
   
    Span span = new Span(1,10);
   
    int expected = 1;
   
    for (int actual : span) {
      Assert.assertEquals(actual, expected);
View Full Code Here

        targetVocab.getID("es")
      };
   
    HierarchicalPhrase targetPhrase = new HierarchicalPhrase(
        targetWords,
        new Span(0,5),
        Collections.<LabeledSpan>emptyList(),
        targetCorpusArray);
   
//    results = lexProbs.calculateLexProbs(phrases, phraseIndex, targetPhrase);
    float sourceGivenTarget = lexProbs.lexProbSourceGivenTarget(phrases, phraseIndex, targetPhrase);
View Full Code Here

 
  private HierarchicalPhrase getTargetPhrase(String targetPhrase, int startIndex, int endIndex) {
   
    return new HierarchicalPhrase(
        targetVocab.getIDs(targetPhrase),
        new Span(startIndex,endIndex),
        Collections.<LabeledSpan>emptyList(),
        targetCorpusArray);

  }
View Full Code Here

TOP

Related Classes of joshua.corpus.Span

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.