Skip to content

Commit

Permalink
add license
Browse files Browse the repository at this point in the history
  • Loading branch information
simonamazzarino committed Aug 24, 2024
1 parent 510b179 commit a007378
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright © 2024 <Simona Mazzarino, Federico Mazzoni>

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.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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('<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:

```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.




0 comments on commit a007378

Please sign in to comment.