Examples of PairOfFloats


Examples of edu.umd.cloud9.io.pair.PairOfFloats

    if (featSet > 2) {
      // uppercase token matching features : find uppercased tokens that exactly appear on both sides
      // lack of this evidence does not imply anything, but its existence might indicate parallel
//      fSentence.replaceAll("([',:;.?%!])", " $1 ");
//      eSentence.replaceAll("([',:;.?%!])", " $1 ");
      PairOfFloats pair = getUppercaseRatio(fTokenizer.processContent(fSentence), eTokenizer.processContent(eSentence));
      features.add("uppercaseratio1=" + pair.getLeftElement() );
      features.add("uppercaseratio2=" + pair.getRightElement() );
    }

    if (featSet > 3) {
      // future work = count number of single/double letter words in src and trg side
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

    // now, read tokens in first sentence and keep track of sequences of uppercased tokens in buffer
    HashSet<String> upperCaseMap1 = getUppercaseParts(tokens1);
    HashSet<String> upperCaseMap2 = getUppercaseParts(tokens2);
    float cntUpperRatio1 = getRatio(upperCaseMap1, upperCaseMap2);
    float cntUpperRatio2 = getRatio(upperCaseMap2, upperCaseMap1);
    PairOfFloats result = new PairOfFloats(cntUpperRatio1, cntUpperRatio2);
    return result;
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

public class PairOfFloatsTest {

  @Test
  public void testBasic() throws IOException {
    PairOfFloats pair = new PairOfFloats(3.14f, 2.0f);

    assertTrue(pair.getLeftElement() == 3.14f);
    assertTrue(pair.getRightElement() == 2.0f);
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

    assertTrue(pair.getRightElement() == 2.0f);
  }

  @Test
  public void testSerialize() throws IOException {
    PairOfFloats origPair = new PairOfFloats(3.14f, 2.0f);

    ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(bytesOut);

    origPair.write(dataOut);

    PairOfFloats pair = new PairOfFloats();

    pair.readFields(new DataInputStream(new ByteArrayInputStream(bytesOut.toByteArray())));

    assertTrue(pair.getLeftElement() == 3.14f);
    assertTrue(pair.getRightElement() == 2.0f);
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

    assertTrue(pair.getRightElement() == 2.0f);
  }

  @Test
  public void testComparison1() throws IOException {
    PairOfFloats pair1 = new PairOfFloats(3.14f, 2.0f);
    PairOfFloats pair2 = new PairOfFloats(3.14f, 2.0f);
    PairOfFloats pair3 = new PairOfFloats(3.14f, 1.0f);
    PairOfFloats pair4 = new PairOfFloats(0.3f, 9.0f);
    PairOfFloats pair5 = new PairOfFloats(9.9f, 0.0f);

    assertTrue(pair1.equals(pair2));
    assertFalse(pair1.equals(pair3));

    assertTrue(pair1.compareTo(pair2) == 0);
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

  @Test
  public void testComparison2() throws IOException {
    WritableComparator comparator = new PairOfFloats.Comparator();

    PairOfFloats pair1 = new PairOfFloats(3.14f, 2.0f);
    PairOfFloats pair2 = new PairOfFloats(3.14f, 2.0f);
    PairOfFloats pair3 = new PairOfFloats(3.14f, 1.0f);
    PairOfFloats pair4 = new PairOfFloats(0.3f, 9.0f);
    PairOfFloats pair5 = new PairOfFloats(9.9f, 0.0f);

    assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair2) == 0);
    assertFalse(WritableComparatorTestHarness.compare(comparator, pair1, pair3) == 0);

    assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair2) == 0);
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

    if (featSet > 2) {
      // uppercase token matching features : find uppercased tokens that exactly appear on both sides
      // lack of this evidence does not imply anything, but its existence might indicate parallel
//      fSentence.replaceAll("([',:;.?%!])", " $1 ");
//      eSentence.replaceAll("([',:;.?%!])", " $1 ");
      PairOfFloats pair = getUppercaseRatio(fTokenizer.processContent(fSentence), eTokenizer.processContent(eSentence));
      features.add("uppercaseratio1=" + pair.getLeftElement() );
      features.add("uppercaseratio2=" + pair.getRightElement() );
    }

    if (featSet > 3) {
      // future work = count number of single/double letter words in src and trg side
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

    // now, read tokens in first sentence and keep track of sequences of uppercased tokens in buffer
    HashSet<String> upperCaseMap1 = getUppercaseParts(tokens1);
    HashSet<String> upperCaseMap2 = getUppercaseParts(tokens2);
    float cntUpperRatio1 = getRatio(upperCaseMap1, upperCaseMap2);
    float cntUpperRatio2 = getRatio(upperCaseMap2, upperCaseMap1);
    PairOfFloats result = new PairOfFloats(cntUpperRatio1, cntUpperRatio2);
    return result;
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

    if (featSet > 2) {
      // uppercase token matching features : find uppercased tokens that exactly appear on both sides
      // lack of this evidence does not imply anything, but its existence might indicate parallel
//      fSentence.replaceAll("([',:;.?%!])", " $1 ");
//      eSentence.replaceAll("([',:;.?%!])", " $1 ");
      PairOfFloats pair = getUppercaseRatio(fTokenizer.processContent(fSentence), eTokenizer.processContent(eSentence));
      features.add("uppercaseratio1=" + pair.getLeftElement() );
      features.add("uppercaseratio2=" + pair.getRightElement() );
    }

    if (featSet > 3) {
      // future work = count number of single/double letter words in src and trg side
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfFloats

    // now, read tokens in first sentence and keep track of sequences of uppercased tokens in buffer
    HashSet<String> upperCaseMap1 = getUppercaseParts(tokens1);
    HashSet<String> upperCaseMap2 = getUppercaseParts(tokens2);
    float cntUpperRatio1 = getRatio(upperCaseMap1, upperCaseMap2);
    float cntUpperRatio2 = getRatio(upperCaseMap2, upperCaseMap1);
    PairOfFloats result = new PairOfFloats(cntUpperRatio1, cntUpperRatio2);
    return result;
  }
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.