Aspect-Based-Sentiment-Analysis pins Python 3.7 and TensorFlow 2.5, and adds a professor that can dismiss a prediction
💠Aspect-Based-Sentiment-Analysis: Transformer & Explainable ML (TensorFlow)
At a glance
- What is it?
- A Python package that classifies the sentiment of long documents per aspect and explains the decision through an auxiliary pattern recognizer. The pipeline is the interesting part; the install constraints, a Python 3.7 only floor and a setup.py that imports the package it installs, are the practical obstacles.
- Who is it for?
- This package suits a team that needs per-aspect sentiment on long documents and cares about how much to trust each label, because the professor stage is a real second opinion rather than a saliency picture. It does not suit a fresh environment: the install floor is Python 3.7 with TensorFlow 2.5 and transformers 4.8 pinned exactly, and building from source needs those dependencies present before setup.py can read the version.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 35 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 12, 2026, and from our analysis. They are not legal advice.
Editorial analysis
python_requires pins the install to Python 3.7 and nothing else
The install story lives in setup.py, and the first line to read there is not a dependency but an interpreter constraint: python_requires is set to ==3.7.*, which accepts 3.7 and rejects every other version. The two libraries the project is actually about are pinned by exact version too, tensorflow==2.5 and transformers==4.8, while the remaining seven entries, pytest, scikit-learn, ipython, google-cloud-storage, testfixtures, optuna and spacy, are unpinned. That combination means the pinned half of the environment is fixed to a 2021 era stack while the unpinned half floats, which is the least predictable way to arrange it. The repository also ships an environment.yml at the root, so there is a conda route alongside pip, and the last recorded push is dated 2026-09-07. Nothing in the tree suggests the constraint has been revisited.
setup.py imports the package it is supposed to install
The second line of setup.py is an import of the package itself: import aspect_based_sentiment_analysis as absa, used a few lines later to fill in version=absa.__version__. So the build script cannot get the version number without first importing a package whose import pulls in TensorFlow and transformers. In practice that means a source install in a clean environment has to satisfy the runtime dependencies before pip can install the thing that declares them, which inverts the usual order and is the kind of detail that turns into an afternoon. Two smaller things sit in the same file. include_package_data is False while the long description is the readme text, so package data is not shipped implicitly. And the description string is built by concatenating two literals, Aspect Based Sentiment Analysis: Transformer and Interpretability (TensorFlow), which is not the same wording the project page carries.
The pipeline ends in a professor that can overrule the model
The stages are ordinary until the last one. Inputs are pre-processed into a task holding examples, each a pair of a text and an aspect, which are then tokenized, encoded and passed to the model. The model predicts, and then the package does something unusual instead of post-processing the output directly: an independent component called the professor supervises and explains the prediction, and it may dismiss a prediction outright when the model's internal states or outputs look suspicious. That is what the explanations are for, since a dismissed prediction is itself a signal about reliability. The same sequence written out by hand looks like this:
import aspect_based_sentiment_analysis as absa
name = 'absa/classifier-rest-0.2'
model = absa.BertABSClassifier.from_pretrained(name)
tokenizer = absa.BertTokenizer.from_pretrained(name)
professor = absa.Professor(...) # Explained in detail later on.
text_splitter = absa.sentencizer() # The English CNN model from SpaCy.
nlp = absa.Pipeline(model, tokenizer, professor, text_splitter)
# Break down the pipeline `call` method.
task = nlp.preprocess(text=..., aspects=...)
tokenized_examples = nlp.tokenize(task.examples)
input_batch = nlp.encode(tokenized_examples)
output_batch = nThe listing stops at output_batch = n, and the professor line is the one to read twice, because it is constructed with an ellipsis rather than arguments, its configuration being explained later in the readme.
Long documents get cut into sentences because their sentiment tends to blur
The readme states the reason for splitting plainly: the sentiment of long texts tends to be fuzzy and neutral, so a document may be broken into smaller independent chunks, called spans, which can be a single sentence or several. In the code above the splitter is absa.sentencizer(), which wraps the English CNN model from SpaCy and cuts a document into single sentences, after which each sentence is processed on its own. The readme also names the cost of that choice, since longer spans carry richer context and give the model more to work with. So the default is precision on short units at the price of cross-sentence context, and anyone whose aspect is expressed across a sentence boundary is paying for the default. The pipeline implementation is pointed at directly for the details.
The pattern recognizer was written from observations, not trained
The explanatory machinery is an auxiliary model called the pattern recognizer, and its job is to predict patterns, described as weighted compositions of tokens, from the model's inputs, outputs and internal states. How it came to exist is the interesting part. Rather than research and build a trainable recognizer, the authors started from observations and prior knowledge, and the result is BasicPatternRecognizer, kept in aspect_based_sentiment_analysis/aux_models.py. The motivation was attention: the classifier is a transformer where self-attention layers hold most parameters, so attention values were analysed as a proxy for understanding the model, which is what many explainability articles do. Plugging it in looks like this:
import aspect_based_sentiment_analysis as absa
recognizer = absa.aux_models.BasicPatternRecognizer()
nlp = absa.load(pattern_recognizer=recognizer)
completed_task = nlp(text=..., aspects=['slack', 'price'])
slack, price = completed_The second listing ends on completed_, so the shape of the call is visible and its result is not. What matters for a reader is the third line: the recognizer is passed into load as an argument, which means the auxiliary model is optional at the API level and the default pipeline does not use this one.
Nine cited repositories and one claim about all of them
The opening section makes a commercial argument, and it does it by sweeping. It says there are over 100 repositories on GitHub around sentiment analysis, numbers nine of them with links, and then states that all of them are hard to commercialize and reuse open-source research projects, before saying this project cleans up that research. So nine specific repositories, from ABSA-PyTorch through TD-LSTM to a memory-based variant, carry a blanket judgement with no per-project reasoning attached, and the alternative being offered is a package with its own constraints rather than an unlicensed one. Two sentences later the readme asks for a star, adding that this is important to keep the project alive. The technical discussion continues after that with the article the work is written up in, Do You Trust in Aspect-Based Sentiment Analysis, published in March 2021.
The quick start is five lines and one model name
Everything the readme asks you to do first fits in five lines: import the package, call absa.load(), pass a sentence about Slack subscriptions with two aspects, and assert that the price aspect is negative while the slack aspect is positive. The load function builds a ready-to-use pipeline, and you can hand it a model name or a path to your own model, with a list of available models referred to further down; the only model named in the visible text is absa/classifier-rest-0.2. The readme's advice after the example is to build a custom model that reflects your data, on the grounds that predictions will be more accurate and stable. The example folder backs that up with train_classifier.py, an optimization.db, optimization_check.py, a notebook whose filename is spelled pattens.ipynb, and an images directory.
The whole entry point is:
import aspect_based_sentiment_analysis as absa
nlp = absa.load()
text = ("We are great fans of Slack, but we wish the subscriptions "
"were more accessible to small startups.")
slack, price = nlp(text, aspects=['slack', 'price'])
assert price.sentiment == absa.Sentiment.negative
assert slack.sentiment == absa.Sentiment.positiveApache-2.0, no releases, and a WhiteSource configuration
Licensing is the tidiest part of this repository. setup.py declares Apache-2.0, the license file sits at the root, and the project metadata agrees. Versioning is not. There are no GitHub releases at all, so the version you get is whatever the package index holds, and the version string itself is read out of the package at build time, which is the arrangement described above. The tree is small and legible: the package directory, data/, examples/, tests/, setup.py, environment.yml, a .gitignore and a .whitesource configuration file. There is no continuous integration configuration in the listed entries, so nothing in the repository itself runs the tests, and pytest is a declared dependency without a declared runner.
Editorial conclusion
This package suits a team that needs per-aspect sentiment on long documents and cares about how much to trust each label, because the professor stage is a real second opinion rather than a saliency picture. It does not suit a fresh environment: the install floor is Python 3.7 with TensorFlow 2.5 and transformers 4.8 pinned exactly, and building from source needs those dependencies present before setup.py can read the version. Before you commit, check whether your interpreter can satisfy that floor, decide whether you will use a packaged model such as absa/classifier-rest-0.2 or train your own, and read what the pattern recognizer can and cannot tell you, since it was written from observations rather than trained. If you need span-level control, remember the default splitter cuts documents into single sentences and discards cross-sentence context.
Frequently asked questions
What does Aspect-Based-Sentiment-Analysis do with a text?
It classifies the sentiment of a possibly long text for several named aspects at once. In the readme example a sentence about Slack subscriptions is passed with the aspects slack and price, and the two come back with different sentiments.
How do I run aspect-based sentiment analysis with this package?
Call absa.load() to get a ready-to-use pipeline, then pass the text and a list of aspects. You can pass a model name such as absa/classifier-rest-0.2 or a path to your own model, and the readme encourages building a custom model that reflects your data.
What is the professor component in Aspect-Based-Sentiment-Analysis?
It is an independent component that supervises and explains a model prediction instead of the package post-processing the output directly. It may dismiss a prediction when the model's internal states or outputs look suspicious, which is how the readme frames reliability.
What Python version does Aspect-Based-Sentiment-Analysis require?
setup.py sets python_requires to ==3.7.*, so 3.7 only. It also pins tensorflow to 2.5 and transformers to 4.8, while pytest, scikit-learn, ipython, google-cloud-storage, testfixtures, optuna and spacy are unpinned.
How does the package handle documents longer than one sentence?
A text splitter breaks the document into spans, and the default absa.sentencizer() uses the English CNN model from SpaCy to cut it into single sentences that are then processed independently. The readme notes that longer spans would give the model richer context.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/scalaconsultants-aspect-based-sentiment-analysis)