Beispiel #1
0
def printResult(ind, data):
    for i in ind:
        tid = data[i][0]
        db = dbConnector(dbpath)
        print(
            db.get_articles(
                "SELECT id, title FROM articles WHERE id = '%s'" % str(tid),
                1))
Beispiel #2
0
def create2():
    db = dbConnector('d:/db/clean.db')
    pm = persistenceManager()
    data = db.get_articles('''SELECT id, content FROM articles''', 50)
    en = Engine(data, term_count_csv_path2, id_mat_path2, vec_mat_path2, True)
    en.print()
    pm.map2csv(term_count_csv_path2, ['term', 'count'], en.termCountMap)
    np.save(vec_mat_path2, en.idVectorMatrix)
    np.save(id_mat_path2, en.ids)
    idf = en.applyIdf()
    np.save(idf_vec_mat_path2, idf)
Beispiel #3
0
def read():
    db = dbConnector('d:/db/clean.db')
    pm = persistenceManager()
    data = db.get_articles('''SELECT id, content FROM articles''', 1000)
    en = Engine(data, term_count_csv_path, id_mat_path, vec_mat_path, False)
    en.print()
Beispiel #4
0
 def getArticlesFromDb(self, path, records):
     db = dbConnector(dbpath)
     return db.get_articles('''SELECT id, title, content FROM articles''',
                            records)