From a007378332cf74b7369d024aa8dc48c2f1d2a3de Mon Sep 17 00:00:00 2001 From: Simona Mazzarino Date: Sat, 24 Aug 2024 13:40:50 +0200 Subject: [PATCH] add license --- LICENSE | 7 +++++++ README.md | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..043af21 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright © 2024 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 53c4959..50430a9 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,42 @@ This library provides tools for analyzing the trust between two people in a conv - **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: + +```python +pip install tetra-textual-trust-analyzer +``` + +## Quickstart +You can import the Trust class using +```python +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](https://perspectiveapi.com/) and create your own key. + +```python +trust_analyzer = Trust('') +``` +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: + +```python +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. + +```python +for maxim, score in zip(['Similarity', 'Quantity', 'Manner'], scores): + print (maxim, score) +``` + +## Examples + +You can find a notebook example in the [notebook](https://github.com/simonamazzarino/TETRA/tree/main/example_notebook) folder. + + + +