-
Notifications
You must be signed in to change notification settings - Fork 3
/
learn.py
29 lines (25 loc) · 824 Bytes
/
learn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from db import spartandb
from PyDictionary import PyDictionary
from learner import learner
read_file = open("subjects.txt","r")
keywords = read_file.read().split(",")
keywords = list(set(keywords))
dbclient = spartandb()
dictionary = PyDictionary()
for keyword in keywords:
dbclient.insert_subject(keyword.lower())
read_file.close()
read_file = open("objects.txt","r")
keywords = read_file.read().split(",")
keywords = list(set(keywords))
dbclient = spartandb()
dictionary = PyDictionary()
for keyword in keywords:
dbclient.insert_object(keyword.lower())
for key in keyword.split(" "):
if dictionary.synonym(key) is not None:
for synonym in dictionary.synonym(key):
dbclient.insert_object(synonym)
learner_mod = learner()
learner_mod.read()
#print dbclient.get_keywords()