🌈 Types#

class text_machina.src.types.DetectionLabels(value)[source]#

Bases: Enum

Labels for detection tasks.

GENERATED: str = 'generated'#
HUMAN: str = 'human'#
class text_machina.src.types.LabeledSpan(**data)[source]#

Bases: BaseModel

check_valid_positions()[source]#
Return type:

LabeledSpan

end: int#
label: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'end': FieldInfo(annotation=int, required=True), 'label': FieldInfo(annotation=str, required=True), 'start': FieldInfo(annotation=int, required=True, metadata=[Ge(ge=0)])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

start: int#
class text_machina.src.types.Placeholders(value)[source]#

Bases: Enum

Placeholders to be used across TextMachina.

NO_EXTRACTOR: str = 'NO-EXTRACTOR'#
NO_PROMPT: str = 'NO-PROMPT'#
class text_machina.src.types.Prompt(**data)[source]#

Bases: BaseModel

Wrapper for a prompt.

extractor: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'extractor': FieldInfo(annotation=str, required=True), 'template': FieldInfo(annotation=str, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

template: str#
class text_machina.src.types.PromptedDataset(**data)[source]#

Bases: BaseModel

Wrapper for a prompted dataset used to generate MGT texts.

human_texts: List[str]#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'human_texts': FieldInfo(annotation=List[str], required=True), 'prompted_texts': FieldInfo(annotation=List[str], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

prompted_texts: List[str]#
class text_machina.src.types.TaskType(value)[source]#

Bases: str, Enum

An enumeration.

ATTRIBUTION: str = 'attribution'#
BOUNDARY: str = 'boundary'#
DETECTION: str = 'detection'#
MIXCASE: str = 'mixcase'#