(self, entities)
| 285 | logger.info(f"Maximum error tolerance reached, skipping text id: {id}") |
| 286 | |
| 287 | def entity_evaluate(self, entities): |
| 288 | entities = "\n".join(entities) |
| 289 | user_prompt = ( |
| 290 | "Analyze the entity list I provide and extract all entities (e.g., proper nouns, discipline terminologies, abstract and collective nouns, etc.). Follow these rules STRICTLY:\n" |
| 291 | "1. Extract as many nouns from the text as possible\n" |
| 292 | "2. Do not include any verbs or words without specific meanings such as time, location, number, measurement, etc.\n" |
| 293 | "3. Output EXACTLY one entity per line\n" |
| 294 | "4. Maintain ORIGINAL spelling/case from the input\n" |
| 295 | "5. Ensure that the entities are not repeated\n" |
| 296 | |
| 297 | "Input entity list:\n" |
| 298 | f"{entities}\n" |
| 299 | |
| 300 | "Now process this list. \n" |
| 301 | ) |
| 302 | |
| 303 | response = self.call_api(user_prompt) |
| 304 | verify_entities = response.split("\n") |
| 305 | verify_entities = list(set([item.strip() for item in verify_entities if len(item.strip()) > 0])) |
| 306 | return verify_entities |
no test coverage detected