Skip to main content

No project description provided

Project description

Text Labeling AI Wizard (tailwiz)

tailwiz is an AI-powered tool for labeling text. It has three main capabilties: classifying text (tailwiz.classify), parsing text given context and prompts (tailwiz.parse), and generating text given prompts (tailwiz.generate).

Installation

Install tailwiz through pip:

python -m pip install tailwiz

Usage

In this section, we outline the three main functions of tailwiz and provide example workflows.

tailwiz.classify(text_to_label, prelabeled_text=None, output_metrics=False)

Given text, classify the text.

Parameters:

  • text_to_label : pandas.DataFrame, List[str]]. Data structures containing text to classify. If in a pandas DataFrame, the column name must be text.
  • prelabeled_text : pandas.DataFrame, List[List[str, Union[str, int]]], default None. Pre-labeled text to enhance the performance of the classification task. If in a pandas DataFrame, the text column must be named text and the label column must be named label.
  • output_metrics : bool, default False. Whether to output performance_estimate together with results in a tuple.

Returns:

  • results : List[List[str, Union[str, int]]. Classification results.
  • performance_estimate : Dict[str, float]. Dictionary of metric name to metric value mappings. Included together with results in a tuple if output_metrics is True. Uses prelabeled_text to give an estimate of the accuracy of the classification. One vs. all metrics are given for multiclass classification.

Example:

>>> import tailwiz
>>> results = tailwiz.classify(
...     text_to_label=['You are the best!', 'You make me sick'],
...     prelabeled_text=[
...         ['Love you to the moon', 'nice'],
...         ['I hate you', 'mean'],
...         ['Have a great day', 'nice']
...     ]
... )
>>> results
['nice', 'mean']

tailwiz.parse(text_to_label, prelabeled_text=None, output_metrics=False)

Given a prompt and a context, parse the answer from the context.

Parameters:

  • text_to_label : pandas.DataFrame, List[List[str, str]]. Data containing prompts and contexts from which answers will be parsed. If in a pandas DataFrame, the context column name must be context and the prompt column name must be prompt.
  • prelabeled_text : pandas.DataFrame, List[List[str, str, str]], default None. Pre-labeled tuples to enhance the performance of the parsing task. If in a pandas DataFrame, the context column name must be context, the prompt column name must be prompt, and the label column must be label.
  • output_metrics : bool, default False. Whether to output performance_estimate together with results in a tuple.

Returns:

  • results : List[List[str, str, str]]. Parsed results.
  • performance_estimate : Dict[str, float]. Dictionary of metric name to metric value mappings. Included together with results in a tuple if output_metrics is True. Uses prelabeled_text to give an estimate of the accuracy of the parsing job.

Example:

>>> import tailwiz
>>> results = tailwiz.parse(
...     text_to_label=[['Extract the number.', 'figure 8']],
...     prelabeled_text=[
...         ['Extract the number.', 'Noon is twelve oclock', 'twelve'],
...         ['Extract the number.', '10 jumping jacks', '10'],
...         ['Extract the number.', 'I have 3 eggs', '3'],
...     ]
... )
>>> results
['8']

tailwiz.generate(text_to_label, prelabeled_text=None, output_metrics=False)

Given a prompt, generate an answer.

Parameters:

  • text_to_label : pandas.DataFrame, List[str]]. Data structures containing prompts for which answers will be generated. If in a pandas DataFrame, the prompt column name must be prompt.
  • prelabeled_text : pandas.DataFrame, List[List[str, str, int]], default None. Pre-labeled text to enhance the performance of the text generation task. If in a pandas DataFrame, the prompt column must be named prompt and the label column must be named label.
  • output_metrics : bool, default False. Whether to output performance_estimate together with results in a tuple.

Returns:

  • results : List[List[str, Union[str, int]]. Generated prompt results.
  • performance_estimate : Dict[str, float]. Dictionary of metric name to metric value mappings. Included together with results in a tuple if output_metrics is True. Uses prelabeled_text to give an estimate of the accuracy of the text generation job.

Example:

>>> import tailwiz
>>> results = tailwiz.generate(
...     text_to_label=['Is this sentence Happy or Sad? I am crying my eyes out.'],
...     prelabeled_text=[
...         ['Is this sentence Happy or Sad? I love puppies!', 'Happy'],
...         ['Is this sentence Happy or Sad? I do not like you at all.', 'Sad'],
...     ]
... )
>>> results
['Sad']

Templates (Notebooks)

Use these Jupyter Notebook examples as templates to help load your data and run any of the three tailwiz functions:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tailwiz-0.0.6.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

tailwiz-0.0.6-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file tailwiz-0.0.6.tar.gz.

File metadata

  • Download URL: tailwiz-0.0.6.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for tailwiz-0.0.6.tar.gz
Algorithm Hash digest
SHA256 0d4b5b55a8caf8f5d91bf6677936d742551fa61168c9479a9a3e421ab0da21ca
MD5 cca2d9d84589faf99285074ef55743a6
BLAKE2b-256 9a49cf4888c806ed504b35f2cdbf9534d86236f31f6fd21a221936174dea053f

See more details on using hashes here.

File details

Details for the file tailwiz-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: tailwiz-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for tailwiz-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ac7a7e68c340d14fd5ebea9e704fd6f0bada63595e746117cd8d598ab219bcf1
MD5 3a96063007e60d1317f98249ea5e529d
BLAKE2b-256 2729c26e9d5e6f52094d2c2a7d4ad5613932f7d44c63d1d1a93a0d1763eefad7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page