diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2021-11-26 17:57:07 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2021-11-26 17:57:07 +0000 |
commit | 1f5dec8047af8c58ce3acb5014d82caf7e6766df (patch) | |
tree | 5d54f191befb210c733f7a5a85de2906c79509f0 /database.py | |
parent | fd2b9c85377df274514c6f0542cd6d1dbcbab183 (diff) | |
download | searchEngine-1f5dec8047af8c58ce3acb5014d82caf7e6766df.tar.gz searchEngine-1f5dec8047af8c58ce3acb5014d82caf7e6766df.zip |
split large texts up into more managable chunks
Diffstat (limited to 'database.py')
-rw-r--r-- | database.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/database.py b/database.py index 5c326b4..8fc3584 100644 --- a/database.py +++ b/database.py @@ -84,6 +84,11 @@ class Database: cursor.execute("SELECT COUNT(*) FROM documents;")
return cursor.fetchone()[0]
+ def get_max_linked_terms(self):
+ with self.__connection.cursor(factory = DatabaseCursor) as cursor:
+ cursor.execute("SELECT MAX(`document_id`) + 2 FROM term_weights;")
+ return cursor.fetchone()[0]
+
def append_terms(self, terms):
with self.__connection.cursor(factory = DatabaseCursor) as cursor:
cursor.executemany("INSERT OR IGNORE INTO vocabulary(term) VALUES (?);", [(term, ) for term in terms])
@@ -211,5 +216,6 @@ if __name__ == "__main__": # print(db.test_log(100))
# print(db.test_log(21))
# db.get_tf_idf_table()
- for i, v in db.get_tf_idf_score("enzyme", 1).items():
- print(i, v)
\ No newline at end of file + #for i, v in db.get_tf_idf_score("enzyme", 1).items():
+ # print(i, v)
+ print(db.get_max_linked_terms())
|