zensols.edusenti package#

Submodules#

zensols.edusenti.app#

Inheritance diagram of zensols.edusenti.app

Pretraining and sentiment student to instructor review sentiment corpora and analysis.

class zensols.edusenti.app.Application(unpacker)[source]#

Bases: NLPClassifyPackedModelApplication

Classifies sentiment in Albanian.

CLASS_INSPECTOR = {}#
__init__(unpacker)#
install_corpus()[source]#

Install the sentiment corpus.

Return type:

Path

predict_csv(text_or_file)[source]#

Create predictions from a newline separated file of sentences.

Parameters:

text_or_file (str) – newline delimited file of sentences or a sentence

Return type:

Path

zensols.edusenti.cli#

Inheritance diagram of zensols.edusenti.cli

Command line entry point to the application.

class zensols.edusenti.cli.ApplicationFactory(*args, **kwargs)[source]#

Bases: ApplicationFactory

__init__(*args, **kwargs)[source]#
classmethod get_application()[source]#

Get the prediction app with the predict method.

Return type:

Application

zensols.edusenti.cli.main(args=['/Users/landes/opt/lib/python/bin/sphinx-build', '-M', 'html', '/Users/landes/view/nlp/edusenti/target/doc/src', '/Users/landes/view/nlp/edusenti/target/doc/build'], **kwargs)[source]#
Return type:

ActionResult

zensols.edusenti.domain#

Inheritance diagram of zensols.edusenti.domain

Contains domain and container and utility classes to parse read the corpus.

class zensols.edusenti.domain.SentimentDataframeStash(dataframe_path, installer, resource, lang, labels)[source]#

Bases: ResourceFeatureDataframeStash

Create the dataframe by reading the sentiment sentences from the corpus files.

__init__(dataframe_path, installer, resource, lang, labels)#
labels: Tuple[str]#

The labels of the classification, which are:

* ``+``: positive sentiment
* ``-``: negative sentiment
* ``n``: neutral sentiment
lang: str#

The corpus language.

class zensols.edusenti.domain.SentimentFeatureDocument(sents, text=None, spacy_doc=None, label=None, pred=None, softmax_logit=None, topic='none', emotion='none')[source]#

Bases: LabeledFeatureDocument

A feature document that contains the topic (i.e. subject) and emotion (i.e. joy, fear, etc) of the corresponding sentence(s). This document usually has one sentence per the corpus, but can have more if the language parser chunks it as such.

__init__(sents, text=None, spacy_doc=None, label=None, pred=None, softmax_logit=None, topic='none', emotion='none')#
emotion: str = 'none'#

The emotion of the reveiw (i.e. joy, fear, surpise, etc). Default to none for predictions.

property is_prediction: bool#

Whether the document has a prediction.

topic: str = 'none'#

The subject of the review (i.e. project, instruction, general, etc). Default to none for predictions.

write(depth=0, writer=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]#

Write the document and optionally sentence features.

Parameters:
  • n_sents – the number of sentences to write

  • n_tokens – the number of tokens to print across all sentences

  • include_original – whether to include the original text

  • include_normalized – whether to include the normalized text

class zensols.edusenti.domain.SentimentFeatureDocumentParser(*args, **kwargs)[source]#

Bases: WhiteSpaceTokenizerFeatureDocumentParser

A white space tokenizer that sets all the parameters of the spaCy tokenizer to simplify the configuration.

__init__(*args, **kwargs)[source]#

Module contents#