relevanceai.operations_new.sentiment.transform#

Add Sentiment to your dataset

Module Contents#

class relevanceai.operations_new.sentiment.transform.SentimentTransform(text_fields: list, model_name: str = 'cardiffnlp/twitter-roberta-base-sentiment', highlight: bool = False, positive_sentiment_name: str = 'positive', max_number_of_shap_documents: Optional[int] = None, min_abs_score: float = 0.1, output_fields: list = None, sensitivity: float = 0, device: int = None, strategy: str = 'value_max', eps: float = 1e-09, **kwargs)#

To write your own operation, you need to add: - name - transform

preprocess(self, text: str)#
property classifier(self)#
property label_mapping(self)#
analyze_sentiment(self, texts: List[str], max_number_of_shap_documents: Optional[int] = None, min_abs_score: float = 0.1)#
property explainer(self)#
get_shap_values(self, text: str, sentiment_ind: int = 2, max_number_of_shap_documents: Optional[int] = None, min_abs_score: float = 0.1)#

Get SHAP values

property name(self)#

abstractproperty for name

transform(self, documents)#

abstractmethod for transform