def set_doctypes(self, doctype1, doctype2):
        if doctype1 == doctype2:
            raise ValueError('Please enter two different doctypes')

        d = Db().get_doctype_counts()
        if doctype1 not in d.keys():
            raise ValueError('Unknown doctype: ' + doctype1)

        if doctype2 not in d.keys():
            raise ValueError('Unknown doctype: ' + doctype2)

        self.doctype1 = doctype1
        self.doctype2 = doctype2
예제 #2
0
    def set_doctypes(self, doctype1, doctype2):
        if doctype1 == doctype2:
            raise ValueError('Please enter two different doctypes')

        d = Db().get_doctype_counts()
        if doctype1 not in d.keys():
            raise ValueError('Unknown doctype: ' + doctype1)

        if doctype2 not in d.keys():
            raise ValueError('Unknown doctype: ' + doctype2)

        self.doctype1 = doctype1
        self.doctype2 = doctype2
    def execute(self):
        pl = []
        db = Db()

        d = db.get_doctype_counts()
        self.doctype1_count = d.get(self.doctype1)
        self.doctype2_count = d.get(self.doctype2)

        self.doctype1_word_count = db.get_words_count(self.doctype1)
        self.doctype2_word_count = db.get_words_count(self.doctype2)

        for word in self.words:
            p = self.p_for_word(db, word)
            pl.append(p)

        result = self.p_from_list(pl)

        return result
예제 #4
0
    def execute(self):
        pl = []
        db = Db()

        d = db.get_doctype_counts()
        self.doctype1_count = d.get(self.doctype1)
        self.doctype2_count = d.get(self.doctype2)

        self.doctype1_word_count = db.get_words_count(self.doctype1)
        self.doctype2_word_count = db.get_words_count(self.doctype2)

        for word in self.words:
            p = self.p_for_word(db, word)
            pl.append(p)

        result = self.p_from_list(pl)

        return result
 def execute(self):
     Db().reset()
     Status().execute()
 def execute(self):
     db = Db()
     return db.get_doctype_counts().items()
예제 #7
0
 def execute(self):
     db = Db()
     return db.get_doctype_counts().items()
예제 #8
0
def is_doctype_valid(doctype):
    return Db().get_words_count(doctype) > 0