| from pydantic import BaseModel | |
| from typing import Optional | |
| from typing import List | |
| import time | |
| class NER_Request (BaseModel): | |
| text: str | |
| entities: List[str] | |
| class NER_Response (BaseModel): | |
| success: int | |
| result: str | |
| description: Optional[str] = "" | |
| errorCode: Optional[int] = 0 | |
| errorDescriptin: Optional[str] = "" | |
| entity_labels_sample = [ | |
| "team", | |
| "developer", | |
| "technology", | |
| "tool", | |
| "amount", | |
| "duration", | |
| "capacity", | |
| "company", | |
| "currency" | |
| ] | |
| def entities_list_to_dict(entitiesList: List[str]): | |
| return {key: '' for key in entitiesList} | |
| def set_start () -> time: | |
| return time.time() | |
| def audit_elapsedtime(function: str, start: time): | |
| end = time.time() | |
| elapsedtime = end-start | |
| print("------------------") | |
| print(f"[{function}] Elapsed time: {elapsedtime}") | |
| print("------------------") | |
| return elapsedtime |