Skip to content

Commit 8d06157

Browse files
committed
Added many prints to debug
1 parent aad872d commit 8d06157

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

app.py

+19
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def webhook():
9797
r = requests.get(i["payload"]["url"])
9898
send_message(sender_id, "Clearing old classifier...")
9999
clfdict[sender_id] = None
100+
dumpclean(clfdict)
100101
send_message(sender_id, "Learning from the file...")
101102

102103
clfdict[sender_id] = MyTextClassifier(r.content)
@@ -141,6 +142,24 @@ def webhook():
141142
return "ok", 200
142143

143144

145+
def dumpclean(obj):
146+
if type(obj) == dict:
147+
for k, v in obj.items():
148+
if hasattr(v, '__iter__'):
149+
print(k)
150+
dumpclean(v)
151+
else:
152+
print('%s : %s' % (k, v))
153+
elif type(obj) == list:
154+
for v in obj:
155+
if hasattr(v, '__iter__'):
156+
dumpclean(v)
157+
else:
158+
print(v)
159+
else:
160+
print(obj)
161+
162+
144163
def send_message(recipient_id, message_text):
145164

146165
print("sending message to {recipient}: {text}".format(recipient=recipient_id, text=message_text))

src/classifier.py

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def learn(self, file, isString = False):
3333
print("Learning from the file...")
3434
authorsAndText = self.htmlParser.parseChat(file, isString)
3535
data = pd.DataFrame(authorsAndText, columns=["author", "text"])
36+
37+
print("Selles failis on autorid " + data.author + "classifier on misasi + " + (self.text_clf is not None))
3638
self.text_clf = self.text_clf.fit(data.text.astype('U'), data.author)
3739
print("Learning is finished.")
3840

0 commit comments

Comments
 (0)