def add(self, word):
    if (self.word2idx.get(word) is None):
        self.word2idx[word] = self.idx
        self.idx += 1
def add(self, word):
    if (self.word2idx.get(word) is None):
        self.word2idx[word] = self.idx
        self.idx += 1