TETRA: TExtual TRust Analyzer
Project description
TETRA: TExtual TRust Analyzer
This library provides tools for analyzing the trust between two people in a conversation analyzing their messages. The library focuses on evaluating manner, similarity, and quantity for each text. It leverages various NLP libraries and APIs, including Google's Perspective API, NLTK, Presidio, and Sentence Transformers.
Features
- Manner Analysis: Evaluates the manner of text using the Perspective API, checking for harmful content indicators such as toxicity, profanity, threats, etc.
- Similarity Analysis: Computes the cosine similarity between two pieces of text using a pre-trained sentence transformer model.
- Quantity Analysis: Measures the informational density of text, taking into account named entities and coherence with another piece of text.
Installation
You can install TETRA by using pip:
pip install tetra-textual-trust-analyzer
Quickstart
You can import the Trust class using
from tetra.trust_main import Trust
Then you create a Trust objects and set your Perspective API key. If you don't already have a Perspective API key, you can visit this link and create your own key.
trust_analyzer = Trust('<insert-your-Perspective-API-key>')
To obtain the trust scores between two sentences you need to use the method get_trust()
and provide the sentences as parameters in the following way:
scores = trust_analyzer.get_trust(
"This is the main comment, of which we are analyzing the trust.",
"And this is the comment it is responding to. For example, it could be a question.")
This method returns as output the trust scores, i.e. manner, similarity and quantity scores.
for maxim, score in zip(['Similarity', 'Quantity', 'Manner'], scores):
print (maxim, score)
Examples
You can find a notebook example in the notebook folder.
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 tetra_textual_trust_analyzer-0.1.1.tar.gz
.
File metadata
- Download URL: tetra_textual_trust_analyzer-0.1.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.9 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d254fa6742f5b908f3fa63757fbd490e151c96193dbf181b425b9830d7ad61f7 |
|
MD5 | de4bad7eb41a09bed85a6212e72e4dcb |
|
BLAKE2b-256 | 2211e828e130c4589e175dd36d32686d6f7575ca3da87da0a2271f30b416bbd5 |
File details
Details for the file tetra_textual_trust_analyzer-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: tetra_textual_trust_analyzer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.9 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a56c57b68e9671433cf7d24cd6840f4bc2436e50f04c80c44e4dff3de3c2b7bc |
|
MD5 | eab838f5e3fd8c9ae7e81ca24f9da1e6 |
|
BLAKE2b-256 | 44aa4f9cd172e9d1a9ffd29cae60948b13eeda03de9bf7b978d481e3a03a12e9 |