Sofia (indra.sources.sofia)¶
Sofia is a general purpose natural language processing system developed at UPitt and CMU by N. Miskov et al.
Sofia API (indra.sources.sofia.api)¶
-
indra.sources.sofia.api.process_json(json_obj)[source]¶ Return processor by processing a JSON object returned by Sofia.
Parameters: json_obj (json) – A JSON object containing extractions from Sofia. Returns: sp – A SofiaProcessor object which has a list of extracted INDRA Statements as its statements attribute. Return type: indra.sources.sofia.processor.SofiaProcessor
-
indra.sources.sofia.api.process_json_file(fname)[source]¶ Return processor by processing a JSON file produced by Sofia.
Parameters: fname (str) – The name of the JSON file to process Returns: A SofiaProcessor object which has a list of extracted INDRA Statements as its statements attribute. Return type: indra.sources.sofia.processor.SofiaProcessor
-
indra.sources.sofia.api.process_table(fname)[source]¶ Return processor by processing a given sheet of a spreadsheet file.
Parameters: fname (str) – The name of the Excel file (typically .xlsx extension) to process Returns: sp – A SofiaProcessor object which has a list of extracted INDRA Statements as its statements attribute. Return type: indra.sources.sofia.processor.SofiaProcessor
-
indra.sources.sofia.api.process_text(text, out_file='sofia_output.json', auth=None)[source]¶ Return processor by processing text given as a string.
Parameters: - text (str) – A string containing the text to be processed with Sofia.
- out_file (Optional[str]) – The path to a file to save the reader’s output into. Default: sofia_output.json
- auth (Optional[list]) – A username/password pair for the Sofia web service. If not given, the SOFIA_USERNAME and SOFIA_PASSWORD values are loaded from either the INDRA config or the environment.
Returns: sp – A SofiaProcessor object which has a list of extracted INDRA Statements as its statements attribute. If the API did not process the text, None is returned.
Return type: indra.sources.sofia.processor.SofiaProcessor