Inserts a word vector

@param word   the word to insert
@param vector the vector to insert
482678
@Override
    public void putVector(String word, INDArray vector) {
        if (word == null)
            throw new IllegalArgumentException("No null words allowed");
        if (vector == null)
            throw new IllegalArgumentException("No null vectors allowed");
        int idx = vocab.indexOf(word);
        syn0.slice(idx).assign(vector);

    }
1037461
private SparseDoubleVector getSemanticVector(String word) {
        SparseDoubleVector v = wordToSemantics.get(word);
        if (v == null) {
            // lock on the word in case multiple threads attempt to add it at
            // once
            synchronized(this) {
                // recheck in case another thread added it while we were waiting
                // for the lock
                v = wordToSemantics.get(word);
                if (v == null) {
                    v = new CompactSparseVector();
                    wordToSemantics.put(word, v);
                }
            }
        }
        return v;
    }
641796
private SemanticVector getSemanticVector(String word) {
        SemanticVector v = wordToMeaning.get(word);
        if (v == null) {
            v = (useSparseSemantics) 
                ? new SparseSemanticVector(vectorLength)
                : new DenseSemanticVector(vectorLength);
            wordToMeaning.put(word, v);
        }
        return v;
    }
194796
protected boolean place(final Word word, final Point start) {
        final Graphics graphics = this.bufferedImage.getGraphics();

        final int maxRadius = computeRadius(dimension, start);
        final Point position = word.getPosition();
        
        for (int r = 0; r < maxRadius; r += 2) {
            for (int x = Math.max(-start.x, -r); x <= Math.min(r, dimension.width - start.x - 1); x++) {
                position.x = start.x + x;

                final int offset = (int) Math.sqrt(r * r - x * x);
                
                // try positive root
                position.y = start.y + offset;
                if (position.y >= 0 && position.y < dimension.height && canPlace(word)) {
                    collisionRaster.mask(word.getCollisionRaster(), position);
                    graphics.drawImage(word.getBufferedImage(), position.x, position.y, null);
                    return true;
                }
                
                // try negative root (if offset != 0)
                position.y = start.y - offset;
                if (offset != 0 && position.y >= 0 && position.y < dimension.height && canPlace(word)) {
                    collisionRaster.mask(word.getCollisionRaster(), position);
                    graphics.drawImage(word.getBufferedImage(), position.x, position.y, null);
                    return true;
                }
            }
        }

        return false;
    }
1193592
@Override
    public void writeWord(final long word) {
        if(wordsWritten == wordCount) {
            throw new RuntimeException("Cannot write more words, backing array full!");
        }

        int bitsLeftInWord = wordLength;

        while(bitsLeftInWord > 0) {
            // Move to the next byte if the current one is fully packed.
            if(bitsLeftInByte == 0) {
                byteIndex++;
                bitsLeftInByte = BITS_PER_BYTE;
            }

            final long consumedMask;
            if(bitsLeftInWord == 64) {
                consumedMask = ~0L;
            } else {
                consumedMask = ((1L << bitsLeftInWord) - 1L);
            }

            // Fix how many bits will be written in this cycle. Choose the
            // smaller of the remaining bits in the word or byte.
            final int numberOfBitsToWrite = Math.min(bitsLeftInByte, bitsLeftInWord);
            final int bitsInByteRemainingAfterWrite = (bitsLeftInByte - numberOfBitsToWrite);

            // In general, we write the highest bits of the word first, so we
            // strip the highest bits that were consumed in previous cycles.
            final long remainingBitsOfWordToWrite = (word & consumedMask);

            final long bitsThatTheByteCanAccept;
            // If there is more left in the word than can be written to this
            // byte, shift off the bits that can't be written off the bottom.
            if(bitsLeftInWord > numberOfBitsToWrite) {
                bitsThatTheByteCanAccept = (remainingBitsOfWordToWrite >>> (bitsLeftInWord - bitsLeftInByte));
            } else {
                // If the byte can accept all remaining bits, there is no need
                // to shift off the bits that won't be written in this cycle.
                bitsThatTheByteCanAccept = remainingBitsOfWordToWrite;
            }

            // Align the word bits to write up against the byte bits that have
            // already been written. This shift may do nothing if the remainder
            // of the byte is being consumed in this cycle.
            final long alignedBits = (bitsThatTheByteCanAccept << bitsInByteRemainingAfterWrite);

            // Update the byte with the alignedBits.
            bytes[byteIndex] |= (byte)alignedBits;

            // Update state with bit count written.
            bitsLeftInWord -= numberOfBitsToWrite;
            bitsLeftInByte = bitsInByteRemainingAfterWrite;
        }

        wordsWritten ++;
    }
988628
public void setRow(int row, DoubleVector vector) {
        checkIndices(row, vector.length() - 1);

        values[row] = vector.get(row);
    }
1191311
public static void replaceWords(StringBuilder input, String[] words, String[] replaces) {
        replaceWords(input, words, replaces, false);
    }
90411
protected boolean ignoreWord(String word) throws IOException {
    if (!considerIgnoreWords) {
      return false;
    }
    if (word.endsWith(".") && !wordsToBeIgnored.contains(word)) {
      return isIgnoredNoCase(word.substring(0, word.length()-1));  // e.g. word at end of sentence
    }
    return isIgnoredNoCase(word);
  }
152408
public void add(Vector v)
	{
		x += v.x;
		y += v.y;
		z += v.z;
	}
1027639
def writeWord(self, word):
        
        self.data.write(pack(self.endianness + ("H" if not self.signed else "h"), word))
349259
def add(self, word):
        """"""
        if not word or word.strip() == '':
            return
        self.words[word]=word
439165
protected void indexVectorInternal(double[] vector) throws Exception {
		if (vector.length != vectorLength) {
			throw new Exception("The dimensionality of the vector is wrong!");
		}
		// append the persistent index
		appendPersistentIndex(vector);
		// append the ram-based index
		if (loadIndexInMemory) {
			vectorsList.add(vector);
		}
	}
1126711
public function add($word, $row, $column)
    {
        $this->words[] = new Word($word, $row, $column);
    }
944534
public static boolean insert(String word, String natureWithFrequency)
    {
        if (word == null) return false;
        if (HanLP.Config.Normalization) word = CharTable.convert(word);
        CoreDictionary.Attribute att = natureWithFrequency == null ? new CoreDictionary.Attribute(Nature.nz, 1) : CoreDictionary.Attribute.create(natureWithFrequency);
        if (att == null) return false;
        if (dat.set(word, att)) return true;
        if (trie == null) trie = new BinTrie<CoreDictionary.Attribute>();
        trie.put(word, att);
        return true;
    }
758491
@Override
    public void writeVectorInt(Vector<Integer> vector) {
        log.debug("writeVectorInt: {}", vector);
        writeAMF3();
        buf.put(AMF3.TYPE_VECTOR_INT);
        if (hasReference(vector)) {
            putInteger(getReferenceId(vector) << 1);
            return;
        }
        storeReference(vector);
        putInteger(vector.size() << 1 | 1);
        buf.put((byte) 0x00);
        for (Integer v : vector) {
            buf.putInt(v);
        }
        // debug
        if (log.isDebugEnabled()) {
            int pos = buf.position();
            buf.position(0);
            StringBuilder sb = new StringBuilder();
            HexDump.dumpHex(sb, buf.array());
            log.debug("\n{}", sb);
            buf.position(pos);
        }
    }
368597
@Deprecated
    public static void writeWordVectors(@NonNull Word2Vec vec, @NonNull String path) throws IOException {
        BufferedWriter write = new BufferedWriter(
                new OutputStreamWriter(new FileOutputStream(new File(path), false), "UTF-8"));

        writeWordVectors(vec, write);

        write.flush();
        write.close();
    }
597644
public WordBuilder<I> repeatAppend(int num, Word<I> word) {
        if (num == 0) {
            return this;
        }

        int wLen = word.length();
        int allLen = wLen * num;

        ensureAdditionalCapacity(allLen);

        for (int i = num; i > 0; i--) {
            word.writeToArray(0, array, length, wLen);
            length += wLen;
        }

        return this;
    }