Preprocessing
Preprocessing

Preprocessing Pipeline

Text normalisation, tokenisation, linguistic feature extraction, and stop word removal with negation preservation

Pipeline Steps

Applied in sequence to every post in all splits

1

Unicode Normalisation

ftfy + NFKC

Fix encoding artefacts and normalise to NFKC form. Handles mojibake, smart quotes, and non-standard whitespace.

2

HTML Stripping

bleach

Remove all HTML tags while preserving the underlying text content. Reddit posts sometimes contain markdown-encoded HTML.

3

Noise Removal

regex + emoji

Remove URLs (http/https), Reddit mentions (@user), subreddit references (r/sub), hashtags, and emoji characters.

4

Text Normalisation

regex

Lowercase all text and collapse runs of 3+ repeated characters to 2 (e.g. 'sooooo' → 'soo'). Normalise all whitespace.

5

Tokenisation & Tagging

spaCy en_core_web_sm

Sentence segmentation, word tokenisation, part-of-speech tagging, and lemmatisation. NER and dependency parsing are disabled for speed.

6

Stopword Removal

spaCy + custom

Remove stopwords from the spaCy list. Negations (not, never, n't, etc.) are explicitly preserved as they carry semantic signal.

7

Token Filtering

custom

Discard tokens that are non-alphabetic or fewer than 2 characters. Retain only meaningful lexical tokens.

8

Linguistic Feature Extraction

custom

Compute 13 surface and psycholinguistic features per post: word count, char count, sentence count, avg sentence length, type-token ratio, pronoun/negation/social/emotion/noun/verb/adj/adv ratios.

Extracted Linguistic Features

13 features computed per post after preprocessing

FeatureDescriptionPsycholinguistic Relevance
word_countTotal token count (all alpha tokens ≥ 2 chars)Post length proxy
char_countCharacter count of cleaned textVerbosity indicator
sentence_countSentence count (spaCy sentencizer)Structural complexity
avg_sentence_lengthword_count / sentence_countProse density
type_token_ratiounique_tokens / total_tokensLexical diversity
pronoun_ratioFirst-person pronouns / total (I, me, my, mine, myself)Self-focus
negation_ratioNegation words / total (not, never, n't, etc.)Negative framing
social_word_ratioSocial vocabulary / total (friend, alone, isolated, etc.)Relational content
emotion_word_ratioEmotion vocabulary / total (sad, empty, hopeless, etc.)Affective content
noun_ratioNOUN tokens / totalReferential density
verb_ratioVERB tokens / totalAction/state density
adj_ratioADJ tokens / totalDescriptive density
adv_ratioADV tokens / totalModification density

Sample Post Explorer

Browse preprocessed examples from the dataset. See the full preprocessing pipeline output for each post.

0 total · page 1/1

No data available

Run run_pipeline.py on Google Colab, then upload the results/ directory to HuggingFace Spaces.