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

Uploaded Source

Built Distribution

tailwiz-0.0.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tailwiz-0.0.3.tar.gz
  • Upload date:
  • Size: 3.4 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.3.tar.gz
Algorithm Hash digest
SHA256 55d0195f28349ea22cecc663caf925ba16df35f5edf630ad4892602c07d234ba
MD5 e73a3f790e14f5b8f8a71193fb4cce53
BLAKE2b-256 eb532859027fcaa4cd561b7e0bb7b9a886f659faebdec7a26942cd6b383224a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tailwiz-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 81dee2a966951931462757599bb2d31d37137fbcc520c743fba4fcc396236002
MD5 d6d686dd51a341250ae681a93fde33cc
BLAKE2b-256 8028f0a11eb635d243a39a10e53911a5657390461db0174b845e6e6e102990e3

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