def add(self, word, count=1):
        """Add a word to the vocabulary and return its index.

        :param word: word to add to the dictionary.

        :param count: how many times to add the word.

        :return: index of the added word.

        WARNING: this function assumes that if the Vocab currently has N words, then
        there is a perfect bijection between these N words and the integers 0 through N-1.
        """
        if word not in self:
            super(Vocab, self).__setitem__(word, len(self))
        self._counts[word] += count
        return self[word]
def add ( self , word , count = 1 ) : if word not in self : super ( Vocab , self ) . __setitem__ ( word , len ( self ) ) self . _counts [ word ] += count return self [ word ]
Add a word to the vocabulary and return its index.

        :param word: word to add to the dictionary.

        :param count: how many times to add the word.

        :return: index of the added word.

        WARNING: this function assumes that if the Vocab currently has N words, then
        there is a perfect bijection between these N words and the integers 0 through N-1.