forked from shrieking-antshrikes/berrynet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathberrynet.py
More file actions
28 lines (24 loc) · 761 Bytes
/
berrynet.py
File metadata and controls
28 lines (24 loc) · 761 Bytes
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
# -*-coding:utf-8 -*-
import os
import sys
from core.settings import BASE_DIR
from db.create import create_database
from core.train import Trainer
if __name__ == '__main__':
# try:
json_path = os.path.join(BASE_DIR, "sources.json")
db_url = os.path.join(BASE_DIR, "berrynet.db")
test_dir = os.path.join(BASE_DIR, "texts")
trainer = Trainer(text_dir=test_dir, json_path=json_path, db_url=db_url)
if not os.path.isfile(db_url):
create_database(db_url)
trainer.train()
# except Exception as e:
# print type(e)
# print "=================="
# print e
# print "=================="
# for i in e.args:
# print i
# print "------------"
print "Finished!"