Process texts with the Receptiviti API
Project description
A Python package to process text with the Receptiviti API.
An R package is also available at Receptiviti/receptiviti-r.
Installation
If needed, download Python from python.org, then install the package with pip:
Release (version 0.1.1)
pip install receptiviti
Development (version 0.1.2)
pip install git+https://github.com/receptiviti/receptiviti-python.git
And load the package in a Python console:
import receptiviti
Examples
# score a single text
single = receptiviti.request("a text to score")
# score multiple texts, and write results to a file
multi = receptiviti.request(["first text to score", "second text"], "filename.csv")
# score texts in separate files
## defaults to look for .txt files
file_results = receptiviti.request(directory = "./path/to/txt_folder")
## could be .csv
file_results = receptiviti.request(
directory = "./path/to/csv_folder",
text_column = "text", file_type = "csv"
)
# score texts in a single file
results = receptiviti.request("./path/to/file.csv", text_column = "text")
API Access
To access the API, you will need to load your key and secret, as found on your dashboard.
You can enter these as arguments in each function call, but by default they will be looked for in these environment variables:
RECEPTIVITI_KEY="32lettersandnumbers"
RECEPTIVITI_SECRET="56LettersAndNumbers"
You can store these in a .env
(in the current directory or ~/Documents
) file permanently:
# use the `dotenv` argument
receptiviti.status(dotenv=True)
# or load variables in beforehand
receptiviti.readin_env()
Or set them temporarily:
import os
os.environ["RECEPTIVITI_KEY"]="32lettersandnumbers"
os.environ["RECEPTIVITI_SECRET"]="56LettersAndNumbers"
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 receptiviti-0.1.1.tar.gz
.
File metadata
- Download URL: receptiviti-0.1.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 879070d50962605ba1ed4e975657d584e536d91ec3515918e8002f6be2b5c95a |
|
MD5 | 941ac4ba3bf99941c1300522968dfad2 |
|
BLAKE2b-256 | 84f2b8e1b63f48f5a73d09fb5cd0d4252a715a4ddb3f7bcc03472723bd760ae7 |
File details
Details for the file receptiviti-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: receptiviti-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17d02a13f7a00f34c4e26bf423e716a5adcc74504b31f77f31e20d65044c77d8 |
|
MD5 | 38b2cffcff0eaa7a0f92440fe8e41eca |
|
BLAKE2b-256 | 06bd66108132ce6ed4eecba6cdd8e02e9d00891fbcd86d95901ebbfa6e6059f0 |