forked from 100rabh1401/VenmoPlugDetector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_model.py
More file actions
36 lines (30 loc) · 1.08 KB
/
run_model.py
File metadata and controls
36 lines (30 loc) · 1.08 KB
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
30
31
32
33
34
35
36
from analysis import *
from scraping import *
def generate_output(username):
payment_text = payment_box_list(username)
predictions = unlabeled_runner(payment_text)
print(payment_text)
print(predictions)
if sum(predictions) == 0:
pmt_conclusion = "{0} probably isn't up to anything shady.".format(username)
p1 = payment_text[0].lower()
p2 = payment_text[1].lower()
pmt_recent = "They recently paid for {0} and {1}.".format(p1, p2)
else:
bad_payments = extract_bad(payment_text, predictions)
bad_payments = format_unknown_length(bad_payments)
pmt_conclusion = "{0} might be up to something!".format(username)
pmt_recent = "We found {0}.".format(bad_payments)
return pmt_conclusion, pmt_recent
def extract_bad(pmts, predictions):
res = []
for i in range(len(predictions)):
if predictions[i] == 1:
res.append(pmts[i])
return res
def format_unknown_length(strings):
result = ""
for s in strings:
s = s.lower()
result += "{0}, ".format(s)
return result[0:-2]