def train(self, data):
    for d in data:
        c = d[1]
        if (c not in self.d):
            self.d[c] = AddOneProb()
        for word in d[0]:
            self.d[c].add(word, 1)
    self.total = sum(map((lambda x: self.d[x].getsum()), self.d.keys()))
def train(self, data):
    for d in data:
        c = d[1]
        if (c not in self.d):
            self.d[c] = AddOneProb()
        for word in d[0]:
            self.d[c].add(word, 1)
    self.total = sum(map((lambda x: self.d[x].getsum()), self.d.keys()))