Skip to content

_extraction is not working #8

@21jiten

Description

@21jiten

from string import Template
import json

sample_que = """Developer Developer Developer - TATA CONSULTANTCY SERVICE Batavia, OH Relevant course work† Database Systems, Database Administration, Database Security & Auditing, Computer Security,Computer Networks, Programming & Software Development, IT, Information Security Concept & Admin,† IT System Acquisition & Integration, Advanced Web Development, and Ethical Hacking: Network Security & Pen Testing. Work Experience Developer TATA CONSULTANTCY SERVICE June 2016 to Present MRM (Government of ME, RI, MS) Developer†††† Working with various technologies such as Java, JSP, JSF, DB2(SQL), LDAP, BIRT report, Jazz version control, Squirrel SQL client, Hibernate, CSS, Linux, and Windows. """
prompts = [person_prompt_tpl, postion_prompt_tpl, skill_prompt_tpl, edu_prompt_tpl]
results = {"entities": [], "relationships": []}

for p in prompts:
_prompt = Template(p).substitute(ctext=clean_text(sample_que))
_extraction = extract_entities_relationships(_prompt, '')
if 'Answer:\n' in _extraction:
_extraction = _extraction.split('Answer:\n ')[1]
if _extraction.strip() == '':
continue
try:
_extraction = json.loads(_extraction.replace("'", "'").replace('`', ''))
except json.JSONDecodeError:
# print(_extraction)
#Temp hack to ignore Skills cut off by token limitation
_extraction = _extraction[:_extraction.rfind("}")+1] + ']}'
_extraction = json.loads(_extraction.replace("'", "'"))
results["entities"].extend(_extraction["entities"])
if "relationships" in _extraction:
results["relationships"].extend(_extraction["relationships"])

its showing - 400 Project is not allowed to use Publisher Model projects/-/locations/us-central1/publishers/google/models/text-bison@001

TypeError Traceback (most recent call last)
Cell In[20], line 11
9 _prompt = Template(p).substitute(ctext=clean_text(sample_que))
10 _extraction = extract_entities_relationships(_prompt, '')
---> 11 if 'Answer:\n' in _extraction:
12 _extraction = _extraction.split('Answer:\n ')[1]
13 if _extraction.strip() == '':

TypeError: argument of type 'NoneType' is not iterable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions