Examples of frequency()


Examples of com.github.pmerienne.trident.ml.nlp.Vocabulary.frequency()

    vocabulary.add("only one");
    vocabulary.add("we are 2");
    vocabulary.add("we are 2");
    vocabulary.add("I like kitten");

    assertEquals(0.25, vocabulary.frequency("only one"), 0.001);
    assertEquals(0.5, vocabulary.frequency("we are 2"), 0.001);
    assertEquals(0.0, vocabulary.frequency("I'm not here"), 0.001);
  }

  @Test
View Full Code Here

Examples of com.github.pmerienne.trident.ml.nlp.Vocabulary.frequency()

    vocabulary.add("we are 2");
    vocabulary.add("we are 2");
    vocabulary.add("I like kitten");

    assertEquals(0.25, vocabulary.frequency("only one"), 0.001);
    assertEquals(0.5, vocabulary.frequency("we are 2"), 0.001);
    assertEquals(0.0, vocabulary.frequency("I'm not here"), 0.001);
  }

  @Test
  public void testAddAll() {
View Full Code Here

Examples of com.github.pmerienne.trident.ml.nlp.Vocabulary.frequency()

    vocabulary.add("we are 2");
    vocabulary.add("I like kitten");

    assertEquals(0.25, vocabulary.frequency("only one"), 0.001);
    assertEquals(0.5, vocabulary.frequency("we are 2"), 0.001);
    assertEquals(0.0, vocabulary.frequency("I'm not here"), 0.001);
  }

  @Test
  public void testAddAll() {
    Vocabulary vocabulary = new Vocabulary();
View Full Code Here

Examples of it.unimi.dsi.mg4j.index.IndexIterator.frequency()

        final IndexIterator i0 = d0 instanceof IndexIterator ? (IndexIterator)d0 : null;
        final IndexIterator i1 = d1 instanceof IndexIterator ? (IndexIterator)d1 : null;
        if ( i0 == null && i1 == null ) return 0;
        if ( ( i0 != null ) != ( i1 != null ) ) return ( i0 != null ) ? 1 : -1;
        try {
          return i1.frequency() - i0.frequency();
        }
        catch ( IOException e ) {
          throw new RuntimeException( e );
        }
      }
View Full Code Here

Examples of it.unimi.dsi.mg4j.index.IndexIterator.frequency()

      long blockSize = total / blockSizeDivisor++; // The approximate size of a block
      IndexIterator indexIterator;
     
      for ( int i = k = 0; i < terms; i++ ) {
        indexIterator = indexReader.nextIterator();
        frequency = indexIterator.frequency();
        if ( ! index.hasPositions ) count += frequency;
        for ( int j = frequency; j-- != 0; ) {
          indexIterator.nextDocument();
          if ( index.hasPositions ) count += indexIterator.count();
        }
View Full Code Here

Examples of it.unimi.dsi.mg4j.index.IndexIterator.frequency()

       
        /** Compare hasNext*/
        Assert.assertEquals(firstIterator.hasNext(), secondIterator.hasNext());
       
        /** Compare frequency*/
        Assert.assertEquals(firstIterator.frequency(), secondIterator.frequency());               
       
        /** Compare positions & count*/     
        while(firstIterator.hasNext()){
          int fr = firstIterator.nextDocument();
          int sr = secondIterator.nextDocument();   
View Full Code Here

Examples of it.unimi.dsi.mg4j.index.IndexIterator.frequency()

          if ( allBitStreamIndices ) {
            for ( t = 0; t < numberOfTerms[ i ]; t++ ) {
              pl.update();
              IndexIterator indexIterator = indexReader[ i ].nextIterator();
              indexFrequency = indexIterator.frequency();
              numberOfPostings += indexFrequency;
              if ( frequencies[ i ] != null && indexFrequency != ( f = frequencies[ i ].readGamma() ) ) {
                System.err.println( "Error in frequency for term " + t + ": expected " + f + " documents, found " + indexFrequency );
                return;
              }
View Full Code Here

Examples of it.unimi.dsi.mg4j.index.IndexIterator.frequency()

          }
          else { // Non-bitstream indices
            for (t = 0; t < numberOfTerms[ i ]; t++) {
              pl.update();
              IndexIterator indexIterator = termLists ? indexReader[ i ].documents( terms[ i ].get( t ) ) : indexReader[ i ].documents( t );
              indexFrequency = indexIterator.frequency();
              numberOfPostings += indexFrequency;
              if (frequencies[i] != null && indexFrequency != (f = frequencies[i].readGamma())) {
                System.err.println("Error in frequency for term " + t
                    + ": expected " + f + " documents, found "
                    + indexFrequency);
View Full Code Here

Examples of it.unimi.dsi.mg4j.index.IndexIterator.frequency()

    for ( int t = 0; t < globalIndex.numberOfTerms; t++ ) {
      terms.readLine( currentTerm );
      indexIterator = indexReader.nextIterator();
      usedIndices = 0;
      frequency = indexIterator.frequency();
     
      for ( int j = 0; j < frequency; j++ ) {
        globalPointer = indexIterator.nextDocument();               
        localIndex = strategy.localIndex( globalPointer )
View Full Code Here

Examples of it.unimi.dsi.mg4j.index.MultiTermIndexIterator.frequency()

        { 2 },
        { 2 },
        { 0 },
        } );
    MultiTermIndexIterator multiTermIndexIterator = (MultiTermIndexIterator)MultiTermIndexIterator.getInstance( i0, i1, i2 );
    assertEquals( 3, multiTermIndexIterator.frequency() );
   
    assertTrue( multiTermIndexIterator.hasNext() );
    assertTrue( multiTermIndexIterator.hasNext() ); // To increase coverage
   
    assertEquals( 0, multiTermIndexIterator.nextDocument() );
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.