@Override public int size() { return frontCodedStringList.size(); }
public int size() { return frontCodedStringList.size(); }
public int size() { return frontCodedStringList.size(); }
/** Creates a new permuted front-coded string list using a given front-coded string list and permutation. * * @param frontCodedStringList the underlying front-coded string list. * @param permutation the underlying permutation. */ public PermutedFrontCodedStringList(final FrontCodedStringList frontCodedStringList, final int[] permutation) { if (frontCodedStringList.size() != permutation.length) throw new IllegalArgumentException("The front-coded string list contains " + frontCodedStringList.size() + " strings, but the permutation is on " + permutation.length + " elements."); this.frontCodedStringList = frontCodedStringList; this.permutation = permutation; }
public ObjectListIterator<CharSequence> listIterator( final int k ) { return new AbstractObjectListIterator<CharSequence>() { final IntListIterator i = IntIterators.fromTo( 0, frontCodedStringList.size() ); public boolean hasNext() { return i.hasNext(); } public boolean hasPrevious() { return i.hasPrevious(); } public CharSequence next() { return frontCodedStringList.get( permutation[ i.nextInt() ] ); } public CharSequence previous() { return frontCodedStringList.get( permutation[ i.previousInt() ] ); } public int nextIndex() { return i.nextIndex(); } public int previousIndex() { return i.previousIndex(); } }; }
public ObjectListIterator<CharSequence> listIterator( final int k ) { return new AbstractObjectListIterator<CharSequence>() { final IntListIterator i = IntIterators.fromTo( 0, frontCodedStringList.size() ); public boolean hasNext() { return i.hasNext(); } public boolean hasPrevious() { return i.hasPrevious(); } public CharSequence next() { return frontCodedStringList.get( permutation[ i.nextInt() ] ); } public CharSequence previous() { return frontCodedStringList.get( permutation[ i.previousInt() ] ); } public int nextIndex() { return i.nextIndex(); } public int previousIndex() { return i.previousIndex(); } }; }
@Override public ObjectListIterator<CharSequence> listIterator(final int k) { return new ObjectListIterator<CharSequence>() { final IntListIterator i = IntIterators.fromTo(0, frontCodedStringList.size()); @Override public boolean hasNext() { return i.hasNext(); } @Override public boolean hasPrevious() { return i.hasPrevious(); } @Override public CharSequence next() { return frontCodedStringList.get(permutation[i.nextInt()]); } @Override public CharSequence previous() { return frontCodedStringList.get(permutation[i.previousInt()]); } @Override public int nextIndex() { return i.nextIndex(); } @Override public int previousIndex() { return i.previousIndex(); } }; }
/** * Creates an initial identifier look-up array * * @param vec */ void init( Word2VecCompress vec ) { idMapping = new ArrayList<Long>( hash.entityNames.size() + 1 ); for( int i = 0; i < this.hash.entityNames.size(); i++ ) { // String name = hash.getEntityName( i ).toString(); Long x = vec.word_id( name ); if( x != null ) { idMapping.add( ( long ) x ); } else { idMapping.add( 0L ); } } }
for( int i = 0; i < hash.entityNames.size(); i++ ) { MutableString name = hash.entityNames.get( i ); if( !name.isEmpty() ) {