How sp1r0s/java-ai-examples works
This repository is a set of runnable Java AI examples, not one combined application. Users start an example through its main method: image selection leads to face detection and an annotated image; text documents go through Spark classification; battery-charge input produces a regression estimate; and a sample sentence produces sentiment labels. The graph preserves these distinct workflows and their documented libraries. The README identifies the four capabilities; source excerpts show their implementations, though not every internal integration is sampled.
Main entry points: SparkMLExample.java Text classifier · FaceDetector.java Face detector · WekaBatteryPredictionExample.java Battery predictor · FaceRecognitionExample.java Image selection UI
Components 21
Computer vision
- Image selection UI
src/main/java/cv/FaceRecognitionExample.java - Face detector
src/main/java/cv/FaceDetector.java - Face cascade
src/main/resources/lbpcascade_frontalface.xml - Annotated image
src/main/java/cv/FaceDetector.java
Machine learning
- Text classifier
src/main/java/ml/SparkMLExample.java - Labeled documents
src/main/java/ml/LabeledDocument.java - Unlabeled documents
src/main/java/ml/Document.java - Tokenizer
src/main/java/ml/SparkMLExample.java - Feature hashing
src/main/java/ml/SparkMLExample.java - Logistic regression
src/main/java/ml/SparkMLExample.java - Class predictions
src/main/java/ml/SparkMLExample.java - Battery predictor
src/main/java/ml/WekaBatteryPredictionExample.java - Training data
src/main/resources/training-set.txt - Battery estimate
src/main/java/ml/WekaBatteryPredictionExample.java
Language processing
- Sentiment example
src/main/java/nlp/NLPExample.java - Sentence sentiment
src/main/java/nlp/NLPExample.java
Other components
- Example user
- OpenCV
- Apache Spark
- Weka
- Stanford NLP
Connections 21
- Example user → Image selection UI: starts
README.md - Image selection UI → Face detector: calls
src/main/java/cv/FaceRecognitionExample.java - Face detector → Face cascade: loads
src/main/java/cv/FaceDetector.java - Face detector → OpenCV: detects faces
src/main/java/cv/FaceDetector.java - Face detector → Annotated image: returns
src/main/java/cv/FaceDetector.java - Image selection UI → Annotated image: displays
src/main/java/cv/FaceRecognitionExample.java - Example user → Text classifier: starts
README.md - Text classifier → Labeled documents: creates training data
src/main/java/ml/SparkMLExample.java - Text classifier → Unlabeled documents: creates test data
src/main/java/ml/SparkMLExample.java - Text classifier → Tokenizer: configures
src/main/java/ml/SparkMLExample.java - Text classifier → Feature hashing: configures
src/main/java/ml/SparkMLExample.java - Text classifier → Logistic regression: configures
src/main/java/ml/SparkMLExample.java - Text classifier → Apache Spark: runs pipeline
src/main/java/ml/SparkMLExample.java - Text classifier → Class predictions: prints predictions
src/main/java/ml/SparkMLExample.java - Example user → Battery predictor: starts
README.md - Battery predictor → Training data: loads
src/main/java/ml/WekaBatteryPredictionExample.java - Battery predictor → Weka: trains and predicts
src/main/java/ml/WekaBatteryPredictionExample.java - Battery predictor → Battery estimate: prints estimate
src/main/java/ml/WekaBatteryPredictionExample.java - Example user → Sentiment example: starts
README.md - Sentiment example → Stanford NLP: processes text
src/main/java/nlp/NLPExample.java - Sentiment example → Sentence sentiment: prints sentiment
src/main/java/nlp/NLPExample.java