Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tetra_textual_trust_analyzer-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file tetra_textual_trust_analyzer-0.1.1.tar.gz.

File metadata

File hashes

Hashes for tetra_textual_trust_analyzer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d254fa6742f5b908f3fa63757fbd490e151c96193dbf181b425b9830d7ad61f7
MD5 de4bad7eb41a09bed85a6212e72e4dcb
BLAKE2b-256 2211e828e130c4589e175dd36d32686d6f7575ca3da87da0a2271f30b416bbd5

See more details on using hashes here.

File details

Details for the file tetra_textual_trust_analyzer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tetra_textual_trust_analyzer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a56c57b68e9671433cf7d24cd6840f4bc2436e50f04c80c44e4dff3de3c2b7bc
MD5 eab838f5e3fd8c9ae7e81ca24f9da1e6
BLAKE2b-256 44aa4f9cd172e9d1a9ffd29cae60948b13eeda03de9bf7b978d481e3a03a12e9

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