nlp_architect.models.absa.inference package
Submodules
nlp_architect.models.absa.inference.data_types module
-
class
nlp_architect.models.absa.inference.data_types.
LexiconElement
(term: list, score: str = None, polarity: str = None, is_acquired: str = None, position: str = None)[source] Bases:
object
-
class
nlp_architect.models.absa.inference.data_types.
Polarity
[source] Bases:
enum.Enum
An enumeration.
-
NEG
= 'NEG'
-
POS
= 'POS'
-
UNK
= 'UNK'
-
-
class
nlp_architect.models.absa.inference.data_types.
SentimentDoc
(doc_text: str = None, sentences: list = None)[source] Bases:
object
-
doc_text
-
json
()[source] Return json representations of the object
Returns: json representations of the object Return type: json
-
pretty_json
()[source] Return pretty json representations of the object
Returns: pretty json representations of the object Return type: json
-
sentences
-
-
class
nlp_architect.models.absa.inference.data_types.
SentimentDocEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source] Bases:
json.encoder.JSONEncoder
-
default
(o)[source] Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
-
-
class
nlp_architect.models.absa.inference.data_types.
SentimentSentence
(start: int, end: int, events: list)[source] Bases:
object
-
end
-
events
-
start
-
-
class
nlp_architect.models.absa.inference.data_types.
Term
(text: str, kind: nlp_architect.models.absa.inference.data_types.TermType, polarity: nlp_architect.models.absa.inference.data_types.Polarity, score: float, start: int, length: int)[source] Bases:
object
-
len
-
polarity
-
score
-
start
-
text
-
type
-
nlp_architect.models.absa.inference.inference module
-
class
nlp_architect.models.absa.inference.inference.
SentimentInference
(aspect_lex: Union[str, os.PathLike], opinion_lex: Union[str, os.PathLike, dict], parse: bool = True, parser='spacy', spacy_model='en_core_web_sm')[source] Bases:
object
Main class for sentiment inference execution.
-
opinion_lex
Opinion lexicon as outputted by TrainSentiment module.
-
aspect_lex
Aspect lexicon as outputted by TrainSentiment module.
-
intensifier_lex
Pre-defined intensifier lexicon.
Type: dict
-
negation_lex
Pre-defined negation lexicon.
Type: dict
-