kazu.krt.utils

Functions

create_new_resource_with_updated_synonyms(...)

Create a new OntologyStringResource with updated Synonyms.

get_resource_manager()

load_parsers()

resource_to_df(resource[, include_behaviour])

Convert an OntologyStringResource to a DataFrame for display in Streamlit.

kazu.krt.utils.create_new_resource_with_updated_synonyms(new_conf, new_cs, resource)[source]

Create a new OntologyStringResource with updated Synonyms.

This function takes a MentionConfidence, a boolean value, and an OntologyStringResource object as inputs. It creates a new OntologyStringResource object with updated synonyms based on the provided MentionConfidence and boolean values. The new_conf parameter represents the new MentionConfidence to be set for the Synonyms. The new_cs parameter represents whether the Synonyms should be case sensitive or not. The resource parameter is the original OntologyStringResource object whose Synonyms are to be updated.

Parameters:
Returns:

Return type:

OntologyStringResource

kazu.krt.utils.get_resource_manager()[source]
Return type:

ResourceManager

kazu.krt.utils.load_parsers()[source]
Return type:

list[OntologyParser]

kazu.krt.utils.resource_to_df(resource, include_behaviour=False)[source]

Convert an OntologyStringResource to a DataFrame for display in Streamlit.

This function takes an OntologyStringResource object as input and transforms it into a pandas DataFrame. The DataFrame has four columns: type, text, confidence, and case_sensitive. The type column indicates whether the synonym is “original” or “alternative”. The text column contains the synonym text. The confidence column contains the mention confidence, and the case_sensitive column indicates whether the synonym is case sensitive or not.

Parameters:
Returns:

Return type:

DataFrame