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 examples.

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 structure containing text to classify. If in a pandas DataFrame, the text column must be named 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[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 must be named context and the prompt column must be named prompt.
  • prelabeled_text : pandas.DataFrame, List[List[str, str, str]], default None. Pre-labeled text to enhance the performance of the parsing task. If in a pandas DataFrame, the context column must be named context, 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[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 structure containing prompts for which answers will be generated. If in a pandas DataFrame, the prompt column must be named prompt.
  • prelabeled_text : pandas.DataFrame, List[List[str, str]], 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[str]. 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.7.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

tailwiz-0.0.7-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tailwiz-0.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 bb6a8e5458ed6840a18dba5ee5c5bc82895d9e358a4b926d2ca48fa757a86e59
MD5 e53c953a4d77a316053ed75aedd98a22
BLAKE2b-256 8cecaf272466bc19362f5fa9b6ae28588b774b25896ec201375e41270036a866

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tailwiz-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 11.3 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 691b68f1fbf8dd20141b6da26f7fa42d0ded3dfc5b84a5b4e36f0e96fbe0ca2e
MD5 1252fea278b629f426b835d0927e4360
BLAKE2b-256 3f5eeb031233675bc1fdbc71d07f929a442443387569770a4c442a74a550aaf1

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