Natural language (indra.assemblers.english.assembler)

class indra.assemblers.english.assembler.EnglishAssembler(stmts=None)[source]

This assembler generates English sentences from INDRA Statements.

Parameters:stmts (Optional[list[indra.statements.Statement]]) – A list of INDRA Statements to be added to the assembler.
statements

A list of INDRA Statements to assemble.

Type:list[indra.statements.Statement]
model

The assembled sentences as a single string.

Type:str
add_statements(stmts)[source]

Add INDRA Statements to the assembler’s list of statements.

Parameters:stmts (list[indra.statements.Statement]) – A list of indra.statements.Statement to be added to the statement list of the assembler.
make_model()[source]

Assemble text from the set of collected INDRA Statements.

Returns:stmt_strs – Return the assembled text as unicode string. By default, the text is a single string consisting of one or more sentences with periods at the end.
Return type:str
indra.assemblers.english.assembler.english_join(lst)[source]

Join a list of strings according to English grammar.

Parameters:lst (list of str) – A list of strings to join.
Returns:A string which describes the list of elements, e.g., “apples, pears, and bananas”.
Return type:str
indra.assemblers.english.assembler.statement_base_verb(stmt_type)[source]

Return the base verb form of a statement type.

Parameters:stmt_type (str) – The lower case string form of a statement type, for instance, ‘phosphorylation’.
Returns:The base verb form of a statement type, for instance, ‘phosphorylate’.
Return type:str
indra.assemblers.english.assembler.statement_passive_verb(stmt_type)[source]

Return the passive / state verb form of a statement type.

Parameters:stmt_type (str) – The lower case string form of a statement type, for instance, ‘phosphorylation’.
Returns:The passive/state verb form of a statement type, for instance, ‘phosphorylated’.
Return type:str
indra.assemblers.english.assembler.statement_present_verb(stmt_type)[source]

Return the present verb form of a statement type.

Parameters:stmt_type (str) – The lower case string form of a statement type, for instance, ‘phosphorylation’.
Returns:The present verb form of a statement type, for instance, ‘phosphorylates’.
Return type:str