(self, that)
return new_BoW
Concat bow.
Concat bow.
Concat bow .
def __add__(self, that):
        """Concat bow."""
        words = self._words.union(that._words)
        numbers = {}
        for word in list(words):
            num1 = self.__numbers.get(word) if self.__numbers.get(word) else 0
            num2 = that.__numbers.get(word) if that.__numbers.get(word) else 0
            numbers[word] = num1 + num2

        new_BoW = BoW()
        new_BoW.__words = words
        new_BoW.__numbers = numbers
        return new_BoW
def __add__ ( self , that ) : words = self . _words . union ( that . _words ) numbers = { } for word in list ( words ) : num1 = self . __numbers . get ( word ) if self . __numbers . get ( word ) else 0 num2 = that . __numbers . get ( word ) if that . __numbers . get ( word ) else 0 numbers [ word ] = num1 + num2 new_BoW = BoW ( ) new_BoW . __words = words new_BoW . __numbers = numbers return new_BoW