speqtr commited on
Commit
41818bf
1 Parent(s): 23dfe32

simple contacts list

Browse files
Files changed (1) hide show
  1. introduck/inference.py +11 -1
introduck/inference.py CHANGED
@@ -17,7 +17,17 @@ def extract_contacts_from_email(payload: str) -> list[list[str]]:
17
  if not payload:
18
  return []
19
 
20
- return [["John Doe", "Acme Corp.", "john@example.com", "ai, nn"]]
 
 
 
 
 
 
 
 
 
 
21
 
22
 
23
  def generate_acceptance_reply(payload: str) -> str:
 
17
  if not payload:
18
  return []
19
 
20
+ nlp: spacy.Language = _load_spacy_model()
21
+ doc = nlp(payload)
22
+
23
+ contacts: list[list[str]] = []
24
+ for ent in doc.ents:
25
+ if ent.label_ != "PERSON":
26
+ continue
27
+
28
+ contacts.append([ent.text, "unknown", "unknown", "no notes"])
29
+
30
+ return contacts
31
 
32
 
33
  def generate_acceptance_reply(payload: str) -> str: