From 20ce2711e24c77c0052c0921c4ef1ca14f244aab Mon Sep 17 00:00:00 2001 From: "Azalea (on HyDEV-Daisy)" Date: Thu, 14 Apr 2022 20:26:26 -0400 Subject: [PATCH] [+] SentiResult data class --- pysenti/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pysenti/__init__.py b/pysenti/__init__.py index be53ba1..f538078 100644 --- a/pysenti/__init__.py +++ b/pysenti/__init__.py @@ -1,4 +1,17 @@ from __future__ import annotations +from typing import NamedTuple, Iterable __version__ = '1.0.0' + +class SentiResult(NamedTuple): + positive: int + negative: int + neutral: int + + def scale(self) -> int: + return self.positive - self.negative + + def is_positive(self) -> bool: + return self.scale() > 0 +