🔎 Exploration#

class text_machina.src.exploration.base.Explorer(dataset)[source]#

Bases: ABC

Base class for explorers that run an interactive CLI to visualize generated datasets.

__init__(dataset)[source]#
get_next_position_or_exit(position, max_position)[source]#

Handles user input to cycle through a dataset.

Parameters:

current_position (int) – the current position.

Returns:

the new position.

Return type:

int

abstract get_panels(example)[source]#

Builds the list of panels for the elements (prompts, texts, etc.) to be printed. This method should be implemented by each task-specific explorer.

Parameters:

example (Dict[str, Any]) – an example from the dataset.

Returns:

lists of panels to be printed in the desired order.

Return type:

List[Panel]

abstract get_title(idx, example)[source]#

Builds a printable title based on an example from the dataset. This method should be implemented by each task-specific explorer.

Parameters:
  • idx (int) – index of the example.

  • example (Dict[str, Any]) – an example from the dataset.

Returns:

a printable title.

Return type:

str

show_example(idx)[source]#

Pretty prints an example from the dataset.

Parameters:

idx (int) – index of the example in the dataset.

Return type:

None

step()[source]#

Steps through a generated dataset, handling user input and showing the texts in a command line UI.

Return type:

None

__abstractmethods__ = frozenset({'get_panels', 'get_title'})#
__dict__ = mappingproxy({'__module__': 'text_machina.src.exploration.base', '__doc__': '\n    Base class for explorers that run an interactive\n    CLI to visualize generated datasets.\n    ', '__init__': <function Explorer.__init__>, 'command_panel': <property object>, 'step': <function Explorer.step>, 'get_next_position_or_exit': <function Explorer.get_next_position_or_exit>, 'show_example': <function Explorer.show_example>, 'get_panels': <function Explorer.get_panels>, 'get_title': <function Explorer.get_title>, '__dict__': <attribute '__dict__' of 'Explorer' objects>, '__weakref__': <attribute '__weakref__' of 'Explorer' objects>, '__abstractmethods__': frozenset({'get_title', 'get_panels'}), '_abc_impl': <_abc_data object>, '__annotations__': {}})#
__module__ = 'text_machina.src.exploration.base'#
__weakref__#

list of weak references to the object (if defined)

_abc_impl = <_abc_data object>#
property command_panel: Panel#

Command panel to help the users with commands. :returns: panel showing the commands and action keys. :rtype: Panel

class text_machina.src.exploration.detection.DetectionExplorer(dataset)[source]#

Bases: Explorer

Explorer for detection tasks.

get_panels(example)[source]#

Builds the list of panels for the elements (prompts, texts, etc.) to be printed. This method should be implemented by each task-specific explorer.

Parameters:

example (Dict[str, Any]) – an example from the dataset.

Returns:

lists of panels to be printed in the desired order.

Return type:

List[Panel]

get_title(idx, example)[source]#

Builds a printable title based on an example from the dataset. This method should be implemented by each task-specific explorer.

Parameters:
  • idx (int) – index of the example.

  • example (Dict[str, Any]) – an example from the dataset.

Returns:

a printable title.

Return type:

str

class text_machina.src.exploration.attribution.AttributionExplorer(dataset)[source]#

Bases: Explorer

Explorer for attribution tasks.

get_panels(example)[source]#

Builds the list of panels for the elements (prompts, texts, etc.) to be printed. This method should be implemented by each task-specific explorer.

Parameters:

example (Dict[str, Any]) – an example from the dataset.

Returns:

lists of panels to be printed in the desired order.

Return type:

List[Panel]

get_title(idx, example)[source]#

Builds a printable title based on an example from the dataset. This method should be implemented by each task-specific explorer.

Parameters:
  • idx (int) – index of the example.

  • example (Dict[str, Any]) – an example from the dataset.

Returns:

a printable title.

Return type:

str

class text_machina.src.exploration.boundary.BoundaryExplorer(dataset)[source]#

Bases: Explorer

Explorer for boundary tasks.

get_panels(example)[source]#

Builds the list of panels for the elements (prompts, texts, etc.) to be printed. This method should be implemented by each task-specific explorer.

Parameters:

example (Dict[str, Any]) – an example from the dataset.

Returns:

lists of panels to be printed in the desired order.

Return type:

List[Panel]

get_title(idx, example)[source]#

Builds a printable title based on an example from the dataset. This method should be implemented by each task-specific explorer.

Parameters:
  • idx (int) – index of the example.

  • example (Dict[str, Any]) – an example from the dataset.

Returns:

a printable title.

Return type:

str

class text_machina.src.exploration.mixcase.MixCaseExplorer(dataset)[source]#

Bases: Explorer

Explorer for mixcase tasks.

get_panels(example)[source]#

Builds the list of panels for the elements (prompts, texts, etc.) to be printed. This method should be implemented by each task-specific explorer.

Parameters:

example (Dict[str, Any]) – an example from the dataset.

Returns:

lists of panels to be printed in the desired order.

Return type:

List[Panel]

get_title(idx, example)[source]#

Builds a printable title based on an example from the dataset. This method should be implemented by each task-specific explorer.

Parameters:
  • idx (int) – index of the example.

  • example (Dict[str, Any]) – an example from the dataset.

Returns:

a printable title.

Return type:

str