-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact_recognizer.py
More file actions
21 lines (20 loc) · 846 Bytes
/
contact_recognizer.py
File metadata and controls
21 lines (20 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from token_recognizers.email_recognizer import get_emails
from token_recognizers.job_recognizer import get_job_title
from token_recognizers.name_recognizer import get_name
from token_recognizers.org_recognizer import get_org
from token_recognizers.loc_recognizer import get_loc
from token_recognizers.phone_recognizer import get_phones
from token_recognizers.website_recognizer import get_websites
from bert_model import get_tokens
from contact import Contact
def recognize_contact(text):
contact = Contact()
ner_list = get_tokens(text)
contact.name = get_name(ner_list)
contact.organization = get_org(ner_list)
contact.addr = get_loc(ner_list)
contact.job_title = get_job_title(text)
contact.phones = get_phones(text)
contact.emails = get_emails(text)
contact.website = get_websites(text)
return contact