Examples of IntOpenHashSet


Examples of com.carrotsearch.hppc.IntOpenHashSet

  }
 
  /** Called by {@link DEPTree#projectivize()}. */
  private DEPNode getSmallestNonProjectiveArc(IntArrayList ids)
  {
    IntOpenHashSet remove = new IntOpenHashSet();
    DEPNode wk, nonProj = null;
    int np, max = 0;
   
    for (IntCursor cur : ids)
    {
      wk = get(cur.value);
      np = isNonProjective(wk);
     
      if (np == 0)
      {
        remove.add(cur.value);
      }
      else if (np > max)
      {
        nonProj = wk;
        max = np;
View Full Code Here

Examples of com.carrotsearch.hppc.IntOpenHashSet

  }
 
  @Deprecated
  private void addNonProjectiveMap(IntObjectOpenHashMap<IntOpenHashSet> map, int cIdx, int nIdx)
  {
    IntOpenHashSet set;
   
    if (map.containsKey(cIdx))
      set = map.get(cIdx);
    else
    {
      set = new IntOpenHashSet();
      map.put(cIdx, set);
    }
   
    set.add(nIdx);
  }
View Full Code Here

Examples of com.carrotsearch.hppc.IntOpenHashSet

 
  @Deprecated
  private IntOpenHashSet getNonProjectiveMapAux(IntObjectOpenHashMap<IntOpenHashSet> map)
  {
    IntIntPair max = new IntIntPair(-1, -1);
    IntOpenHashSet set, remove;
    boolean removed;
    int[] keys;
   
    do
    {
      max.set(-1, -1);
      keys = map.keys().toArray();
      Arrays.sort(keys);
     
      for (int key : keys)
      {
        set = map.get(key);
       
        if (set.size() > max.i2)
          max.set(key, set.size());
      }
     
      removed = false;
     
      if (max.i2 > 0)
      {
        remove = new IntOpenHashSet();
       
        for (IntCursor cur : map.get(max.i1))
        {
          if (map.containsKey(cur.value))
          {
            set = map.get(cur.value);
           
            if (set.contains(max.i1))
            {
              removed = true;
              set.remove(max.i1);
              if (set.isEmpty())  remove.add(cur.value);
            }
          }
        }
       
        for (IntCursor cur : remove)
          map.remove(cur.value);
      }
    }
    while (removed);
           
    return new IntOpenHashSet(map.keys());
  }
View Full Code Here

Examples of com.carrotsearch.hppc.IntOpenHashSet

    }
  }
 
  public DEPTree getDEPTreeWithoutEdited(CTTree cTree, DEPTree dTree)
  {
    IntOpenHashSet set = new IntOpenHashSet();
    addEditedTokensAux(cTree.getRoot(), set);
    int i, j, size = dTree.size();
    DEPTree tree = new DEPTree();
    DEPNode node;
   
    for (i=1,j=1; i<size; i++)
    {
      if (!set.contains(i))
      {
        node = dTree.get(i);
        node.id = j++;
        removeEditedHeads(node.getXHeads(), set);
        removeEditedHeads(node.getSHeads(), set);
View Full Code Here

Examples of com.carrotsearch.hppc.IntOpenHashSet

  }
 
  /** Initializes random centroids. */
  private void initCentroids()
  {
    IntOpenHashSet set = new IntOpenHashSet();
    Random rand = new Random(RAND_SEED);
    d_centroid  = new double[K*D];
    d_scala     = new double[K];
   
    while (set.size() < K)
      set.add(rand.nextInt(N));

    int[] unit;
    int k = 0;
   
    for (IntCursor cur : set)
View Full Code Here

Examples of com.carrotsearch.hppc.IntOpenHashSet

   * @param tree the constituent tree.
   * @return a set of terminal IDs belonging to this argument.
   */
  public IntOpenHashSet getTerminalIdSet(CTTree tree)
  {
    IntOpenHashSet set = new IntOpenHashSet();
   
    for (PBLoc loc : l_locs)
      set.addAll(tree.getNode(loc).getSubTerminalIdSet());
   
    return set;
  }
View Full Code Here

Examples of com.carrotsearch.hppc.IntOpenHashSet

   * @param tree the constituent tree.
   * @return the sorted list of terminal IDs belonging to this argument give the specific tree.
   */
  public int[] getSortedTerminalIdList(CTTree tree)
  {
    IntOpenHashSet set = getTerminalIdSet(tree);
    int[] ids = set.toArray();
   
    Arrays.sort(ids);
    return ids;
  }
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntOpenHashSet

  public int process( final Query query[], final int offset, final int length, final ObjectArrayList<DocumentScoreInfo<Reference2ObjectMap<Index,SelectedInterval[]>>> results ) throws QueryBuilderVisitorException, IOException {
    LOGGER.debug( "Processing Query array \"" + Arrays.toString( query ) + "\", offset=" + offset + ", length="+ length );
    results.clear();
    double lastMinScore = 1;
    int total = 0, count, currOffset = offset, currLength = length;
    final IntOpenHashSet alreadySeen = query.length > 1 ? new IntOpenHashSet() : null;

    for( int i = 0; i < query.length; i++ ) {
      final int initialResultSize = results.size();
     
      DocumentIterator documentIterator = query[ i ].accept( builderVisitor.prepare() );
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntOpenHashSet

   

    if ( ! jsapResult.getBoolean( "noComp" ) ) {
      IndexReader additionalReader;
      IntLinkedOpenHashSet s0 = new IntLinkedOpenHashSet();
      IntOpenHashSet s1 = new IntOpenHashSet();
      IntAVLTreeSet s2 = new IntAVLTreeSet();
      IntIterator it;
      IndexIterator indexIterator, additionalIterator;
      it.unimi.dsi.mg4j.search.DocumentIterator documentIterator;
      int u = 0;
     
      try {
        for (i = 0; i < index.length; i++) {
          pl.expectedUpdates = numberOfTerms[ i ];
          pl.start("Verifying composite iterators in " + index[i] + "...");
          additionalReader = index[ i ].getReader();
         
          for (t = 0; t < numberOfTerms[ i ]; t++) {
            for (u = 0; u < numberOfTerms[ i ]; u++) {
              s0.clear();
              s1.clear();
              // TODO: in case we have positions, we should check them, too
              IntIterators.pour( termLists ? indexReader[ i ].documents( terms[ i ].get( t ) ) : indexReader[ i ].documents( t ), s0 );
              IntIterators.pour( termLists ? indexReader[ i ].documents( terms[ i ].get( u ) ) : indexReader[ i ].documents( u ), s1 );
              s0.retainAll( s1 );
              indexIterator =  termLists ? indexReader[ i ].documents( terms[ i ].get( t ) ) : indexReader[ i ].documents( t );
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntOpenHashSet

      _numIter = numIter;
      _collector = statsCollector;

      int maxDoc = reader.maxDoc();

      IntSet idSet = new IntOpenHashSet();
      while (idSet.size() < numToFetch) {
        int docid = _rand.nextInt(maxDoc);
        if (!idSet.contains(docid) && !reader.isDeleted(docid)) {
          idSet.add(docid);
        }
      }

      docsToFetch = idSet.toIntArray();
    }
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.