kazu.krt.string_editor.utils

Classes

CaseConflictResolutionRequest

ResourceConflict

This class represents a conflict in resources.

ResourceConflictManager

This class is responsible for managing ResourceConflicts in resources.

class kazu.krt.string_editor.utils.CaseConflictResolutionRequest[source]

Bases: Enum

CUSTOM = 3
OPTIMISTIC = 2
PESSIMISTIC = 1
class kazu.krt.string_editor.utils.ResourceConflict[source]

Bases: object

This class represents a conflict in resources.

It provides methods to resolve these conflicts optimistically or pessimistically.

__init__(conflict_dict)[source]
Parameters:

conflict_dict (dict[str, Iterable[OntologyStringResource]]) – A dictionary mapping parser names to a list of resources that are in conflict.

batch_resolve(optimistic)[source]

Resolve the conflict in batch, changing the parameters of all synonyms at once to share the same values.

The optimistic param indicates the minimum case sensitivity and maximum mention confidence should be chosen (otherwise vice-versa)

Parameters:

optimistic (bool) – Whether to resolve the conflict optimistically or pessimistically.

Return type:

None

class kazu.krt.string_editor.utils.ResourceConflictManager[source]

Bases: object

This class is responsible for managing ResourceConflicts in resources.

It provides methods to find conflicts in resources, sync resources for resolved string conflicts and find new conflicts.

__init__(manager)[source]

Initialize with a ResourceManager.

Parameters:

manager (ResourceManager) – The ResourceManager to use.

summary_df()[source]

Create a summary DataFrame of unresolved conflicts.

Returns:

A DataFrame summarizing the unresolved conflicts.

Return type:

DataFrame

sync_resources_for_resolved_resource_conflict_and_find_new_conflicts(conflict)[source]

Sync resources for a resolved conflict and find new conflicts.

This will refresh the internal map of conflicts.

Parameters:

conflict (ResourceConflict) – a resolved ResourceConflict.

Return type:

None