dygoo commited on
Commit
2f675f1
·
verified ·
1 Parent(s): 7d162e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -128,10 +128,13 @@ def extract_entities(search_results: str) -> str:
128
  last_period = trunc.rfind('. ')
129
  search_results = trunc[:last_period + 1] if last_period > 3000 else trunc
130
 
131
- prompt = f"""Extract all person names and organization names from the following text. Do not extract products and service names. Only individuals and organizations. Bring the full details of the name in the newspaper article. For example, if only ACME is mentioned as company name, bring only ACME. IF ACME Inc is mentioned as company name, then you have to extract ACME Inc. In addition, define the relationship between the entity and the company that is being searched. For example, is ACME Inc an owner of the company being searched? Then write 'owner'. Is ACME Inc. a funder of the company being searched? Then write 'funder'.
132
- Format as:
133
- PERSON: [name] - [relationship]
134
- ORG: [organization name] - [relationship]
 
 
 
135
 
136
  Text:
137
  {search_results}"""
 
128
  last_period = trunc.rfind('. ')
129
  search_results = trunc[:last_period + 1] if last_period > 3000 else trunc
130
 
131
+ prompt = f"""Extract all named entities from the following text.
132
+
133
+ Return a JSON object with two keys:
134
+ - "people": a list of names of people mentioned
135
+ - "organizations": a list of organization names mentioned
136
+
137
+ Respond only with valid JSON. Do not include any explanations, comments, or additional formatting.
138
 
139
  Text:
140
  {search_results}"""