def addWord(self,D,s,pos,v):
        #extract string of word from the sentence
        word = s[pos]
        #base case. v is 0, so we're just returning D with the frequency of s[w] incremented, not altering subdictionaries
        if v <= 0:
            # increment the frequency if the word already exists
            if word in D:
                D[word].set_freq(D[word].freq+1)
            # otherwise, create a new entry in D
            else:
                D[word] = Word(word)
            return D

        # if v is greater than 0, we increment the frequency and ask for subdictionaries
        elif v>0:
            if word in D:
                newsub1 = D[word].sub1
                if pos < len(s)-1:
                    newsub1 = self.addWord(D[word].sub1,s,pos+1,v-1)

                newsub2 = D[word].sub2
                if v>1 and pos < len(s)-2:
                    newsub2 = self.addWord(D[word].sub2,s,pos+2,0)

                D[word].set_freq(D[word].freq+1)
                D[word].set_sub1(newsub1)
                D[word].set_sub2(newsub2)
                return D
            else:
                D[word] = Word(word)

                newsub1 = {}
                if pos < len(s)-1:
                    newsub1 = self.addWord(D[word].sub1,s,pos+1,v-1)

                newsub2 = {}
                if v>1 and pos < 2-len(s):
                    newsub2 = self.addWord(D[word].sub2,s,pos+2,0)


                D[word].set_sub1(newsub1)
                D[word].set_sub2(newsub2)
                return D

    # selects a single voice, setting the weights of all other voices to 0
dataset/ETHPy150Open jbrew/pt-voicebox/vbox.py/Voicebox.addWord/swapped operands of `-`