def process_text(text, save_xml_name='trips_output.xml', save_xml_pretty=True): """Return a TripsProcessor by processing text. Parameters ---------- text : str The text to be processed. save_xml_name : Optional[str] The name of the file to save the returned TRIPS extraction knowledge base XML. Default: trips_output.xml save_xml_pretty : Optional[bool] If True, the saved XML is pretty-printed. Some third-party tools require non-pretty-printed XMLs which can be obtained by setting this to False. Default: True Returns ------- tp : TripsProcessor A TripsProcessor containing the extracted INDRA Statements in tp.statements. """ html = trips_client.send_query(text) xml = trips_client.get_xml(html) if save_xml_name: trips_client.save_xml(xml, save_xml_name, save_xml_pretty) return process_xml(xml)
def process_text(text): html = trips_client.send_query(text) xml = trips_client.get_xml(html) with open('test.xml','w') as f: f.write(xml) return process_xml(xml)
def process_text(text, save_xml_name='trips_output.xml'): html = trips_client.send_query(text) xml = trips_client.get_xml(html) if save_xml_name: trips_client.save_xml(xml, save_xml_name) return process_xml(xml)
def process_text(text): html = trips_client.send_query(text) xml = trips_client.get_xml(html) trips_client.save_xml(xml, 'test.xml') return process_xml(xml)