CWMS (indra_world.sources.cwms
)
CWMS is a variant of the TRIPS system. It is a general purpose natural language understanding system with applications in world modeling. For more information, see: http://trips.ihmc.us/parser/cgi/cwmsreader
API (indra_world.sources.cwms.api
)
- indra_world.sources.cwms.api.process_ekb(ekb_str, extract_filter=None, grounding_mode='flat')[source]
Processes an EKB string produced by CWMS.
- Parameters:
ekb_str (str) – EKB string to process
extract_filter (Optional[list]) – A list of relation types to extract. Valid values in the list are ‘influence’, ‘association’, ‘event’ and ‘migration’. If not given, only Influences are extracted since processing other relation types can be time consuming. This argument can be used if the extraction of other relation types such as Events are also of interest.
grounding_mode (Optional[str]) – Selects whether ‘flat’ or ‘compositional’ groundings should be extracted. Default: ‘flat’.
- Returns:
cp – A CWMSProcessor, which contains a list of INDRA statements in its statements attribute.
- Return type:
indra.sources.cwms.CWMSProcessor
- indra_world.sources.cwms.api.process_ekb_file(fname, extract_filter=None, grounding_mode='flat')[source]
Processes an EKB file produced by CWMS.
- Parameters:
fname (str) – Path to the EKB file to process.
extract_filter (Optional[list]) – A list of relation types to extract. Valid values in the list are ‘influence’, ‘association’, ‘event’ and ‘migration’. If not given, only Influences are extracted since processing other relation types can be time consuming. This argument can be used if the extraction of other relation types such as Events are also of interest.
grounding_mode (Optional[str]) – Selects whether ‘flat’ or ‘compositional’ groundings should be extracted. Default: ‘flat’.
- Returns:
cp – A CWMSProcessor, which contains a list of INDRA statements in its statements attribute.
- Return type:
indra.sources.cwms.CWMSProcessor
- indra_world.sources.cwms.api.process_text(text, save_xml='cwms_output.xml', extract_filter=None, grounding_mode='flat')[source]
Processes text using the CWMS web service.
- Parameters:
text (str) – Text to process
save_xml (Optional[str]) – A file name in which to dump the output from CWMS. Default: cwms_output.xml
extract_filter (Optional[list]) – A list of relation types to extract. Valid values in the list are ‘influence’, ‘association’, ‘event’ and ‘migration’. If not given, only Influences are extracted since processing other relation types can be time consuming. This argument can be used if the extraction of other relation types such as Events are also of interest.
grounding_mode (Optional[str]) – Selects whether ‘flat’ or ‘compositional’ groundings should be extracted. Default: ‘flat’.
- Returns:
cp – A CWMSProcessor, which contains a list of INDRA statements in its statements attribute.
- Return type:
indra.sources.cwms.CWMSProcessor
Processor (indra_world.sources.cwms.processor
)
- class indra_world.sources.cwms.processor.CWMSProcessor(xml_string)[source]
Bases:
object
The CWMSProcessor currently extracts causal relationships between terms (nouns) in EKB. In the future, this processor can be extended to extract other types of relations, or to extract relations involving events.
For more details on the TRIPS EKB XML format, see http://trips.ihmc.us/parser/cgi/drum
- Parameters:
xml_string (str) – A TRIPS extraction knowledge base (EKB) in XML format as a string.
- tree
An ElementTree object representation of the TRIPS EKB XML.
- class indra_world.sources.cwms.processor.CWMSProcessorCompositional(xml_string)[source]
Bases:
CWMSProcessor