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
:
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 betext
.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 namedtext
and the label column must be namedlabel
.output_metrics
: bool, default False. Whether to outputperformance_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're 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 becontext
and the prompt column name must beprompt
.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 becontext
, the prompt column name must beprompt
, and the label column must belabel
.output_metrics
: bool, default False. Whether to outputperformance_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 beprompt
.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 namedprompt
and the label column must be namedlabel
.output_metrics
: bool, default False. Whether to outputperformance_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
, seeexamples/classify.ipynb
- For an example of
tailwiz.parse
, seeexamples/parse.ipynb
- For an example of
tailwiz.generate
, seeexamples/generate.ipynb
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tailwiz-0.0.2.tar.gz
.
File metadata
- Download URL: tailwiz-0.0.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01be7d9bdcda04e797daf688e81fb50f833e1a4b6a869d20474d9ec04f717f9a |
|
MD5 | 96a1bf6c04a0e646e93f0631bf1fad89 |
|
BLAKE2b-256 | 39167acec7061ca99cde80bfcba71fee370d59b11c66decce79d31dc69617273 |
File details
Details for the file tailwiz-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: tailwiz-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 090cd04aec504db0097af8d72b3f1a4689e40a8247f4d84eda240c7fed71d8c8 |
|
MD5 | 145a6e02e3778eea84990d2f9f5af5c7 |
|
BLAKE2b-256 | 056ccb32796d3da43fb5ccc180ec2937aa7ab64efbf29ca5c767d9e0d2f43896 |