kazu.krt.components

Functions

save()

This function saves the state of the resource manager and displays success messages in the sidebar.

show_reset_button(reset_func)

show_save_button()

Classes

ParserSelector

PlaceholderResource

This class provides static methods to manage a placeholder resource in the session state.

ResourceEditor

class kazu.krt.components.ParserSelector[source]

Bases: object

static display_parser_selector(exclude=None, clear_state=False)[source]
Parameters:
Return type:

None

static get_selected_parser_name()[source]
Return type:

str | None

static submit_form_and_clear_state()[source]
Return type:

None

static submit_form_and_keep_state()[source]
Return type:

None

PARSER_SELECTOR = 'PARSER_SELECTOR'
class kazu.krt.components.PlaceholderResource[source]

Bases: object

This class provides static methods to manage a placeholder resource in the session state.

static create_placeholder_resource(text, parser_name)[source]

Creates a placeholder resource with a given text and parser name, and stores it in the session state.

Parameters:
  • text (str) – the text to be used in the Synonym instance

  • parser_name (str) – The name of the parser to be associated with the placeholder resource.

Returns:

Return type:

None

static delete_placeholder()[source]
Return type:

None

static get_placeholder_resource()[source]
Return type:

tuple[str, OntologyStringResource]

PLACEHOLDER_RESOURCE = 'PLACEHOLDER_RESOURCE'
class kazu.krt.components.ResourceEditor[source]

Bases: object

static display_case_sensitivity_and_confidence_selector(row, default_syn)[source]

Displays selectors for both case sensitivity and confidence.

Returns a tuple of the selected values.

Parameters:
  • row (list[DeltaGenerator])

  • default_syn (Synonym | None)

Returns:

Return type:

tuple[bool, MentionConfidence]

static display_resource_editor(resources, maybe_parser_name=None, on_click_override=None, args=None)[source]
Parameters:
Return type:

None

static extract_form_data_from_state(parser_name, resources)[source]
Parameters:
Return type:

Iterable[tuple[OntologyStringResource, OntologyStringResource]]

static submit_form_for_addition()[source]

Submits the form for addition of a new resource.

Extracts the placeholder resource and parser name from the session state. Then, it extracts the form data from the state and syncs the resources. Finally, it deletes the placeholder resource from the session state.

Returns:

Return type:

None

ASSOCIATE_ID_SET_DF = 'ASSOCIATE_ID_SET_DF'
ASSOCIATE_ID_SET_EDITOR = 'ASSOCIATE_ID_SET_EDITOR'
BEHAVIOUR_SELECTOR = 'BEHAVIOUR_SELECTOR'
CASE_SELECTOR = 'CASE_SELECTOR'
CONFIDENCE_SELECTOR = 'CONFIDENCE_SELECTOR'
kazu.krt.components.save()[source]

This function saves the state of the resource manager and displays success messages in the sidebar.

It creates placeholders for each message returned by the resource manager’s save method. After a delay of 2 seconds, it empties all the placeholders.

Returns:

Return type:

None

kazu.krt.components.show_reset_button(reset_func)[source]
Parameters:

reset_func (Callable[[...], None])

Return type:

None

kazu.krt.components.show_save_button()[source]
Return type:

None