Skip to content

Commit

Permalink
handle empty named-entity field in VB
Browse files Browse the repository at this point in the history
  • Loading branch information
timho102003 committed Nov 7, 2023
1 parent 5c10b10 commit e307d78
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,9 @@ def run_chat(payload, query_embed, ori_article_id, compare_num=5):
{"title": rec["payload"]["title"], "url": rec["payload"]["url"]}
)
rt.append(readtime.of_text(rec["payload"]["body"]).seconds)
ner_p.update(set(rec["payload"]["named_entities"].get("PER", [])))
ner_l.update(set(rec["payload"]["named_entities"].get("LOC", [])))
ner_o.update(set(rec["payload"]["named_entities"].get("ORG", [])))
ner_p.update(set(rec["payload"].get("named_entities", {}).get("PER", [])))
ner_l.update(set(rec["payload"].get("named_entities", {}).get("LOC", [])))
ner_o.update(set(rec["payload"].get("named_entities", {}).get("ORG", [])))
documents.append(Document(text=cur_doc))

start = time.time()
Expand Down

0 comments on commit e307d78

Please sign in to comment.