Skip to main content

No project description provided

Project description

Text Labeling AI Wizard (tailwiz)

tailwiz is a lightweight, 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=[['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=[['Who is the speaker?', 'Harry said, "Blimey!"']],
...     prelabeled_text=[
...         ['Who is the speaker?', '"Expelliarmus," murmured Ron.', 'Ron'],
...         ['Who is the speaker?', 'Surprised, Dumbledore exclaimed, "wow!", 'Dumbledore'],
...     ]
... )
>>> results
['Harry']

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:

  • For an example of tailwiz.classify, see examples/classify.ipynb
  • For an example of tailwiz.parse, see examples/parse.ipynb
  • For an example of tailwiz.generate, see examples/generate.ipynb

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.4.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tailwiz-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 d44046e72064285efd6fcd699502473abe6387f693f8f12682de9bc454f29560
MD5 9d00d59e6877b2c2cfbe3fcedca0f4f6
BLAKE2b-256 022255f33059b2d2605ab6aae1a4a150db4dbb9c1863cca5a1f3190235c81ab7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tailwiz-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 608de08c4dcbf883fda3414e62e8d10cbc28ec87d5aed290df03793b09fe0116
MD5 ccba118b8ee936667b3ebfd5d92f64a5
BLAKE2b-256 c71c48925575f2d7e3504383c3f1cb0ea890d43481d6e5a69986b6fbfaf5af0c

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