A lightweight text-forensics and stylometry toolkit implemented in Clojure, featuring:
- Linguistic profiling
- Education-level estimation
- Regional (UK/US) English detection
- Psycholinguistic signal analysis
- Authorship similarity using cosine distance
Originally developed during an exploration of computational linguistics, this project is now organized as a standalone text-analysis toolkit.
Extracts core linguistic metrics:
- Total words
- Unique vocabulary count
- Type–Token Ratio (TTR)
- Sentence count
- Average sentence length
- POS tag distribution (via OpenNLP)
Estimates the writer’s educational background using:
- Lexical diversity
- Syntactic complexity
- Adjective/adverb density
Identifies lexical tendencies toward:
- 🇬🇧 UK English — colour, organise, theatre, centre
- 🇺🇸 US English — color, organize, theater, center
Extracts emotional and stylistic cues, analyzing:
- Positive/negative sentiment words
- Negations
- First-person usage
- Passive sentence frequency
- Overall mental/emotional tendencies
Compares two texts using:
- Token frequency vectors
- Cosine similarity
Useful for:
- Stylometry
- Forensic document comparison
- Threat-letter analysis
- Writer profiling
group7-text-forensics/
├── src/group7_text_forensics/ # Core NLP modules (Clojure)
├── resources/ # OpenNLP model files (.bin)
├── test/group7_text_forensics/ # Tests / sample scripts
├── archive/ # Editor caches (not part of runtime)
├── README.md
└── project.clj # Leiningen project definition
The -main function (in core.clj) demonstrates:
- Linguistic profiling
- Education-level estimation
- Regionality detection
- Psychological-state analysis
- Authorship similarity
Run with:
lein run
Example output:
================== Linguistic Profiling ==================
{:total-words 42
:unique-words 31
:type-token-ratio 0.7381
:sentence-count 3
:avg-sentence-length 14.0
:pos-distribution {...}}
Education-level analysis:
High education background
Regional analysis:
Tend to be UK English
Psychological-state analysis:
Negative emotions are obvious, and depression or anxiety may be present
================== Authorship Similarity ==================
Similarity between text1 and text2 => 0.8123
- Clojure
- Leiningen
- OpenNLP models (included in
resources/)
Install & run:
lein deps
lein run
This toolkit demonstrates:
- NLP feature engineering
- Linguistic & psycholinguistic analysis
- Functional programming in Clojure
- Authorship attribution algorithms
- Clean modular design for text processing pipelines
Applicable for:
- Computational linguistics research
- Stylometry experiments
- Forensic text analysis
- NLP education and demos
MIT License