Skip to content

Text processing

categorizeSingleCategory

The categorizeSingleCategory() categorizes the text into one of the categories mentioned in the list based upon the semantic content of the text. The categories should be mentioned as a dictionary. The function receives text and categories as input and provides the fitting category as the output.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.categorize_single_category({"text":"The quick brown fox jumped over the lazy dog", "categories":{"Animals": "Text about animals", "Nature": "Text about nature"}}, _headers=custom_headers)

categorize multiple Categories

The categorizeMultipleCategories() categorizes the text into many of the categories mentioned in the list based upon the semantic content of the text. The categories should be mentioned as a dictionary. The function receives text and categories as input and provides any number of categories that fits the text as the output.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.categorize_multiple_categories({"text":"The quick brown fox jumped over the bush but since the bush is too green, the fox felt happy", "categories":{"Animals": "Text about animals", "Nature": "Text about nature"}}, _headers=custom_headers)

explain topic

The explainTopic() function explains a given text into a simple or complicated topic based on the scale. This function takes two inputs, text and num. The topic to be explained is given to text parameter and the complexity scale in num parameter, where 1 represents that you expect the response to be a beginner friendly whereas 10 represents that the topic is explained to someone at a high proficiency in that field.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.explain_topic({"text":"quantum processing", "num":6, "language":"en"}, _headers=custom_headers)

This function is useful when you want to explain a text in a simple or complicated manner based on a scale from 0 to 10.

Has swear words

The hasSwearWords() function is an API endpoint that checks if a given text contains any swear words. This endpoint is part of an API that accepts a text as input and returns a boolean value indicating the presence of swear words in the text. The returned value is True if the text contains swear words and False otherwise.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.has_swear_words("what a shit head he is", _headers=custom_headers)

This function is useful for applications that require text filtering capabilities, such as chat applications or content moderation systems. With the detected swear words, appropriate action could be taken by either filtering them out or banning the user or proposing a better alternative.

hide swear words

The hideSwearWords() function filters out swear words in a given text. This function accepts a text as input and returns the text with swear words replaced by asterisks. In addition to the text, the function also accepts another parameter custom_list, where we could include any swear words and thus the words mentioned in the custom_list will also be replaced by asterisks.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.hide_swear_words({"text":"what a shit head he is", "custom_list":['boo','hoo']}, _headers=custom_headers)

This function is also useful for such similar applications like chat applications or content moderation systems. Instead of any other actions, this function directly returns the text with swear words replaced by asterisks thereby indicating that it is a swear word and we wish to hide them.

evaluate resume

The evaluate_resume() function evaluates a resume against a set of job requirements. This function takes two inputs, the id of a resume and the id of the list of all the job requirements. Both should be written in a pdf format. After processing, the function returns how good the resume fits the mentioned job requirements in a text response.

1
---

Prompt blipper

The promptBlipper() function is a generic function to ask anything to a large language model. It directly communicates with the specified LLM and then responds in the form of text.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.prompt_blipper({"text": "how are you", "tempField": ""}, _headers=custom_headers)

Get sentiment

The get_sentiment() function classifies a given text into the type of sentiment it conveys. The sentiment may not be just positive or negative but also in between emotions like happiness, sadness, etc. In addition to the sentiment, the function also tells the intensity of the sentiment.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.get_sentiment("such a lovely movie", _headers=custom_headers)

This function is useful when you want to determine the sentiment conveyed by a text and how intense it was portrayed.

paraphrase the text

The paraphrase() function paraphrases a given text. This function receives a text, number of words to be paraphrased and a style in which the user expects the output.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.paraphrase({"text": "Here goes a large chunk of text", "num_words":15, "style":"shakespeare", "language":"english"}, _headers=custom_headers)

This function is useful when you want to paraphrase a huge chunk of text into a specific style with a certain number of words.

simple paraphrasing the text

The paraphraseSimple() function paraphrases a given text without any added characteristics. This function receives just a text and then paraphrases it without any complicated features as mentioned in the previous function.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.paraphrase_simple({"text": "Here goes a large chunk of text", "language":"english"}, _headers=custom_headers)

This function is useful when you want to simply paraphrase a huge chunk of text without any specific guidelines.

breakDownTask

The breakDownTask() function breaks down a given task or text into a specified number of smaller tasks or segments. It requires the text to be broken down and the number of segments as input.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.break_down_task({"text": "process weather data", "num": 6, "language":"spanish"}, _headers=custom_headers)

toxicityIndex

The toxicityIndex() function evaluates the toxicity level of a given text. It requires the text as input and returns a measure of its toxicity.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.toxicity_index("such a shitty song that one is", _headers=custom_headers)

textFromURL

The textFromURL() function extracts text from the content at a specified URL. It requires the URL as input and returns the extracted text.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.text_from_url("https://crypto.stanford.edu/cs142/lectures/url.html", _headers=custom_headers)

promptClaude

The promptClaude() function sends a text prompt to the Claude model and returns the response. It requires the text prompt as input.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.prompt_claude("hello there", _headers=custom_headers)

extract_text

The extract_text() function extracts text from a file specified by its file ID. It requires the file ID as input to process and return the extracted text.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration


configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.extract_text(file_id="docs/demodoc.pdf", _headers=custom_headers)

htmlize

The htmlize() function converts the prompt mentioned in the text into a html document. The function receives text as input and returns a html string as output.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from blipperpy.api.text_api import TextApi
from blipperpy import ApiClient, Configuration


configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
text_api = TextApi(api_client)
result = text_api.htmlize("a page for cats living in space", _headers=custom_headers)