Commit 1c4f3d4d authored by Tags's avatar Tags

Connect new data from esi.wp_esi_ml_data.

parent 07129d22
......@@ -148,7 +148,7 @@ if __name__ == '__main__':
# !!!!graph results
frequency = list(words_frequency.values())
# graph_results(frequency, "The Words Frequencies")
graph_results(frequency, "The Words Frequencies")
# the are some words with great frequency
......
......@@ -26,7 +26,7 @@ class Classifier:
self.train_data = corpus
return
# load external f=dictionary
# load external dictionary
file_name_dictionary = 'large.txt'
file_dict = open(file_name_dictionary, "r")
self.correct_words = set()
......@@ -49,14 +49,26 @@ class Classifier:
train_data = []
# text_id = []
sql1 = '''SELECT wp_esi_tag_news.tag_id, wp_esi_news.title, wp_esi_news.description
FROM wp_esi_news, wp_esi_tag_news WHERE wp_esi_tag_news.news_id=wp_esi_news.id
ORDER BY wp_esi_tag_news.tag_id LIMIT 1000 '''
self.db.query(sql1)
result = self.db.store_result()
data = list()
for tag_id, title, description in result.fetch_row(maxrows=0):
data.append((tag_id, title, description))
# sql1 = '''SELECT wp_esi_tag_news.tag_id, wp_esi_news.title, wp_esi_news.description
# FROM wp_esi_news, wp_esi_tag_news WHERE wp_esi_tag_news.news_id=wp_esi_news.id
# ORDER BY wp_esi_tag_news.tag_id LIMIT 1000 '''
# self.db.query(sql1)
# result = self.db.store_result()
# data = list()
# for tag_id, title, description in result.fetch_row(maxrows=0):
# data.append((tag_id, title, description))
sql1 = '''SELECT wp_esi_ml_data.tag_id, wp_esi_news_accept.title, wp_esi_news_accept.description, wp_esi_news_accept.text
FROM wp_esi_news_accept, wp_esi_ml_data WHERE wp_esi_ml_data.news_id=wp_esi_news_accept.id
ORDER BY wp_esi_ml_data.tag_id'''
self.db.query (sql1)
result = self.db.store_result ()
data = list ()
for tag_id, title, description, text in result.fetch_row (maxrows=0):
if description is not None:
data.append ((tag_id, title, description + text))
else:
data.append ((tag_id, title, text))
for tag_id, _ in self.tags:
texts = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment