Package org.terrier.structures.indexing.singlepass.hadoop.SplitEmittedTerm

Examples of org.terrier.structures.indexing.singlepass.hadoop.SplitEmittedTerm.SETPartitionerLowercaseAlphaTerm


  }
 
  /* Test cases for SETPartitionerLowercaseAlphaTerm */
  public void testSETPLAT() throws Exception
  {
    final SETPartitionerLowercaseAlphaTerm p = new SETPartitionerLowercaseAlphaTerm();
    //single partition
    assertEquals(0, p.calculatePartition('0', 1));
    assertEquals(0, p.calculatePartition('9', 1));
    assertEquals(0, p.calculatePartition('-', 1));
    assertEquals(0, p.calculatePartition('a', 1));
    assertEquals(0, p.calculatePartition('z', 1));
    assertEquals(0, p.calculatePartition('}', 1));
    //two partitions
    assertEquals(0, p.calculatePartition('(', 2));
    assertEquals(0, p.calculatePartition('.', 2));
    assertEquals(0, p.calculatePartition(')', 2));
    assertEquals(0, p.calculatePartition('\\', 2));
    assertEquals(0, p.calculatePartition('/', 2));
   
    assertEquals(0, p.calculatePartition('0', 2));
    assertEquals(0, p.calculatePartition('9', 2));
    assertEquals(0, p.calculatePartition('-', 2));
    assertEquals(0, p.calculatePartition('a', 2));
    assertEquals(0, p.calculatePartition('l', 2));
    assertEquals(0, p.calculatePartition('m', 2));
    assertEquals(1, p.calculatePartition('n', 2));
    assertEquals(1, p.calculatePartition('o', 2));
    assertEquals(1, p.calculatePartition('z', 2));
    assertEquals(1, p.calculatePartition('}', 2));
    //(all upper case goto partition 0)
    assertEquals(0, p.calculatePartition('M', 2));
    assertEquals(0, p.calculatePartition('N', 2));
    assertEquals(0, p.calculatePartition('O', 2));
   
    //three partitions
    assertEquals(0, p.calculatePartition('0', 3));
    assertEquals(0, p.calculatePartition('9', 3));
    assertEquals(0, p.calculatePartition('-', 3));
    assertEquals(0, p.calculatePartition('a', 3));
    assertEquals(0, p.calculatePartition('h', 3));
    assertEquals(0, p.calculatePartition('i', 3));
    assertEquals(1, p.calculatePartition('j', 3));
    assertEquals(1, p.calculatePartition('r', 3));
    assertEquals(2, p.calculatePartition('s', 3));
    assertEquals(2, p.calculatePartition('t', 3));
    assertEquals(2, p.calculatePartition('u', 3));
    assertEquals(2, p.calculatePartition('z', 3));
    assertEquals(2, p.calculatePartition('}', 3));
   
    //26 partitions
    assertEquals(0, p.calculatePartition('0', 26));
    assertEquals(0, p.calculatePartition('9', 26));
    assertEquals(0, p.calculatePartition('-', 26));
    assertEquals(0, p.calculatePartition('a', 26));
    assertEquals(1, p.calculatePartition('b', 26));
    assertEquals(2, p.calculatePartition('c', 26));
    assertEquals(3, p.calculatePartition('d', 26));
    assertEquals(4, p.calculatePartition('e', 26));
    assertEquals(5, p.calculatePartition('f', 26));
    assertEquals(6, p.calculatePartition('g', 26));
    assertEquals(7, p.calculatePartition('h', 26));
    assertEquals(8, p.calculatePartition('i', 26));
    assertEquals(9, p.calculatePartition('j', 26));
    assertEquals(10, p.calculatePartition('k', 26));
    assertEquals(11, p.calculatePartition('l', 26));
    assertEquals(12, p.calculatePartition('m', 26));
    assertEquals(13, p.calculatePartition('n', 26));
    assertEquals(14, p.calculatePartition('o', 26));
    assertEquals(15, p.calculatePartition('p', 26));
    assertEquals(16, p.calculatePartition('q', 26));
    assertEquals(17, p.calculatePartition('r', 26));
    assertEquals(18, p.calculatePartition('s', 26));
    assertEquals(19, p.calculatePartition('t', 26));
    assertEquals(20, p.calculatePartition('u', 26));
    assertEquals(21, p.calculatePartition('v', 26));
    assertEquals(22, p.calculatePartition('w', 26));
    assertEquals(23, p.calculatePartition('x', 26));
    assertEquals(24, p.calculatePartition('y', 26));
    assertEquals(25, p.calculatePartition('z', 26));
  }
View Full Code Here

TOP

Related Classes of org.terrier.structures.indexing.singlepass.hadoop.SplitEmittedTerm.SETPartitionerLowercaseAlphaTerm

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.