Chris Collins

Project

ELSA: entity-level sentiment

A Java library that finds the people, organisations, places, and products in text and works out the sentiment expressed toward each — and who holds it — using a layered ONNX model pipeline.

Started 29 April 2026 · repository

Applied AI

Sentence-level sentiment is too coarse: "Chris hates Android phones but loves the iPhone camera" is neither positive nor negative. ELSA identifies each entity and the sentiment expressed toward it, including who holds the opinion.

Input:  "Chris hates Android Phones but loves the iPhone camera."
Output: Android Phones  [PRODUCT]  NEGATIVE  (0.92)  holder: Chris
        iPhone          [PRODUCT]  POSITIVE  (0.88)  holder: Chris

How it is built

A four-layer pipeline in Java on ONNX Runtime, where each layer can stop early when there is nothing more to find: a subjectivity gate (TF-IDF and logistic regression, about 0.1 ms), a sentence segmenter (OpenNLP), a DistilBERT sentence-sentiment filter, and entity and sentiment-target models. The four ONNX models are trained with Python scripts in the repository (about an hour on Apple Silicon), fetched prebuilt, or replaced with synthetic stubs for CI.

Try it

./scripts/build.sh
./scripts/generate-test-models.sh   # or fetch or train the real models
./scripts/run-analysis.sh

Updates

No updates yet.