Tamil NLP · September 30, 2026
What a 2,000-year-old poem taught me about machine learning
I started with what I thought was a relatively simple question:
Is Tiruvalluvar biased?
The Thirukkural is a Tamil classic consisting of 1,330 couplets, written roughly 2,000 years ago. Tiruvalluvar writes about virtue, wealth, friendship, love, kingship, family, knowledge, poverty, desire and almost everything in between.
Rather than read selected verses and argue about them, I wanted to see whether there were patterns hidden across the entire work.
Does Valluvar systematically choose different words when talking about different people or ideas?
Are particular concepts repeatedly associated with particular kinds of language?
Could those differences be measured?
My plan was to use computation to build what I started calling a Valluvar Lexical Fingerprint.
First identify every word in the Thirukkural. Reduce its different grammatical forms to a common root. Count the roots. Measure which roots occur together. Find unusual associations. And only then investigate whether any of those asymmetries could reasonably be interpreted as bias.
I expected the difficult part to be the statistics.
I was wrong.
I never got there.
Most of the project became about something that sounded embarrassingly simple:
What are the words?
And that turned out to teach me more about machine learning than the sophisticated part I originally intended to build.
One honest note before we begin: very little machine learning happened in the conventional sense. I didn't train a neural network. I didn't fine-tune a language model.
But that itself became one of the lessons.
A surprising amount of real machine-learning work happens before the model: collecting data, cleaning it, deciding what an observation actually represents, labelling it, measuring the quality of those labels, and understanding what your tools are getting wrong.
The model can be the easy bit.
Think of the Thirukkural as a 2,000-year-old recipe book
Imagine inheriting an ancient recipe book.
You want to discover which ingredients its author favoured and which ingredients they tended to use together.
That sounds straightforward.
Count the ingredients.
Except the book doesn't always say tomato.
It says:
tomatoes
tomato-ish
tomatoed
sun-dried-tomato-sauce
and sometimes uses a spelling nobody has used for hundreds of years.
Before counting anything, you need to work out that all of these references involve the same underlying ingredient:
tomato.
That's roughly the problem I encountered with Tamil.
Tamil is morphologically rich. A root can appear in many grammatical forms.
Take the Tamil word for friendship:
நட்பு — naṭpu
Across the Thirukkural it can appear as:
நட்பு
நட்பின்
நட்பினுள்
நட்பிற்கு
நட்பும்
If I want to understand how often Valluvar talks about friendship, those forms need to be connected back to நட்பு.
In NLP this process is broadly called lemmatisation.
That became the first major problem.
But before I could even solve that, I discovered I had an earlier problem.
Lesson 1Never assume you know what a “word” is
I downloaded a structured digital copy of all 1,330 Kurals.
Each couplet contains two lines. So my first attempt was obvious:
Split each line at the spaces.
Now I have the words.
Except I didn't.
The spaces in the source text often represented the poem's metre, not linguistic word boundaries.
Consider part of Kural 46:
போஒய்ப் பெறுவ தெவன்?
A computer splitting on spaces sees:
பெறுவ
தெவன்
But linguistically those boundaries don't represent the intended words.
The relevant forms are:
பெறுவது + எவன்
The poetic structure has effectively cut across the linguistic boundary.
And the opposite problem occurs too.
In the first Kural we encounter:
எழுத்தெல்லாம்
which contains:
எழுத்து + எல்லாம்
“letter” + “all”.
Sometimes my dataset split one word into two.
Sometimes it glued two words together.
And suddenly the first lesson of the project became obvious:
How you divide your data determines what your system can ever discover from it.
In NLP we call this tokenisation.
It sounds like preprocessing.
It isn't.
It is part of the model of reality you are giving the computer.
If the tokens are wrong, everything downstream inherits the mistake.
Lesson 2A tool can be perfectly reasonable and still be completely wrong for your problem
Once I had words, I needed their roots.
For that I used ThamizhiMorph, a finite-state morphological analyser for Tamil.
It is a serious linguistic tool.
There was just one problem.
It was designed for modern Tamil.
The Thirukkural isn't modern Tamil.
Running the analyser against the original metrical text produced analyses for only about one quarter of the word occurrences.
At first that sounds like a bad tool.
It isn't.
I was asking it to operate outside the world it was designed for.
For example, modern Tamil uses:
உலகம் — ulagam — world
The Thirukkural can use the older:
உலகு — ulagu
Similarly, the analyser understands the modern Tamil verb செய் — “do” — but can struggle with classical grammatical forms such as:
செயின்
meaning approximately “if one does”.
Even something as ordinary as நட்பு, friendship, wasn't in the analyser's vocabulary.
This is a classic machine-learning problem:
domain mismatch.
A system trained or engineered for one distribution of language does not automatically generalise to another.
Modern Tamil and Classical Tamil may be the same language historically, but computationally they can represent very different worlds.
It's similar to expecting a system trained on contemporary English to effortlessly understand Shakespeare.
Lesson 3An answer is not the same thing as a correct answer
The same toolkit also ships with “guesser” components, designed to take a stab at words its dictionaries don't know.
They looked dramatically better.
Between them, they returned something for around 90% of the words.
Wonderful.
Until I looked at the answers.
For:
கைவிடுவார் — kaividuvār — those who abandon
one guesser effectively returned:
root = கைவிடுவார்
and classified it as a noun.
But the actual verbal root is:
கைவிடு — kaividu — abandon
The system had produced an answer without really solving the problem.
That taught me a distinction that sounds obvious but is surprisingly easy to forget when building automated systems:
Coverage is not correctness.
A system answering 90% of your questions is not necessarily better than one answering 50%.
You need to know:
How often does it answer?
and separately:
When it answers, how often is it right?
Lesson 4Better data beat a better algorithm
Then something happened that changed the project.
I found a word-separated edition of the Thirukkural prepared by Tamil scholar Dr. P. Pandiyaraja, published on his Tamil Concordance site (tamilconcordance.in).
I aligned that edition character-by-character against my original source while preserving the original text unchanged.
Then I ran exactly the same morphological analyser again.
I didn't improve the algorithm.
I didn't train anything.
I didn't add a neural network.
Recognition went from roughly:
26% → 48%
The same tool suddenly recognised almost twice as much of the text.
Consider this line from Kural 82.
My original source had:
மருந்தெனினும் வேண் டற்பாற் றன்று
The scholar's segmentation represented it as:
மருந்து எனினும் வேண்டற்பாற்று அன்று
Same poem.
Essentially the same letters.
Different boundaries.
And the machine suddenly became dramatically better at understanding it.
This may have been my favourite lesson from the entire project:
Before building a cleverer model, make sure you haven't given the existing model bad data.
Lesson 5When no perfect source exists, use imperfect sources carefully
Even after fixing the word boundaries, more than half the text remained unresolved.
So I began adding other sources of evidence.
I used:
- the modern morphological analyser;
- hand-written rules for Classical Tamil morphology;
- Tamil Wiktionary;
- historical Tamil lexicons and nikandus.
No single source was authoritative enough.
But together they could provide evidence.
Take:
அவா — avā — greed / craving
It appears repeatedly in the Thirukkural but wasn't recognised by the modern analyser.
Tamil Wiktionary recognises it.
And the roughly 10th-century Piṅgala Nikandu contains it too.
Now I have two witnesses from very different periods pointing in the same direction.
This resembles an idea used in machine learning called weak supervision.
Instead of possessing one perfect source of labels, you combine several imperfect sources while retaining information about where each label came from and how much you trust it.
So I began keeping confidence levels.
Not:
“The root is X.”
But:
“Source A proposes X.”
“Rule B supports X.”
“Historical source C attests X.”
“Human validation still required.”
That distinction would soon become extremely important.
Lesson 6Two machines agreeing can still mean both are wrong
One word taught me not to trust consensus blindly:
தரும் — tharum
In context it means something like:
will give / will bring
Its verbal root is:
தா — thā — give
But one of my rules produced:
தரு
And Wiktionary appeared to support it.
Two sources agreed.
Excellent.
Except தரு can mean tree.
The machines had agreed on the wrong analysis.
Then came:
உண்டோ
in the famous line:
அன்பிற்கும் உண்டோ அடைக்கும் தாழ்
“Is there a latch that can shut in love?”
The system connected உண்டோ with:
உண் — eat
Morphologically plausible.
Semantically absurd.
Then:
விசும்பின்
in:
விசும்பின் துளி வீழின் அல்லால்
Here விசும்பு refers to the sky.
But the ending -இன் is ambiguous. It can participate in grammatical structures that make the word look verbal.
The machine chose the wrong one.
The spelling wasn't the problem.
The morphology wasn't necessarily impossible.
Meaning was the problem.
And meaning depended on reading the verse.
Lesson 7Eventually, somebody has to know what the sentence means
This led me to the most important limitation of the automatic pipeline.
Consider:
அல்லல்
A rule can derive one grammatical interpretation.
A dictionary can suggest another.
But in the Kural's context it means:
distress / suffering
Or consider:
பலவும்
A dictionary lookup can lead towards பலவு, jack tree.
But in context it means essentially:
many, with an attached particle.
A computer can generate candidates.
It can rank them.
It can tell me that a morphological analysis is technically possible.
But at some point somebody has to read the actual Kural and say:
That isn't what Valluvar means here.
This is why the next stage of the project requires a Classical Tamil expert.
Not to replace computation.
To create the answer key against which computation can be measured.
In machine learning we'd call that a gold standard.
And I don't have one yet.
That matters.
Lesson 8The last 20% may be harder than the first 80%
As coverage improved, another familiar data problem appeared.
The long tail.
Of the thousands of forms that remained unresolved, roughly three quarters appeared only once.
Words such as:
சிவிகை — sivigai — palanquin
or
நெருநல் — nerunal — yesterday
might occur only once in the entire work.
Each needs investigation.
Each may require historical linguistic knowledge.
And resolving each one changes the overall coverage by almost nothing.
This is the economics of the long tail.
The common cases are comparatively cheap.
The rare cases become progressively expensive.
Getting from 25% to 50% can be easier than getting from 80% to 90%.
This phenomenon appears everywhere in real-world machine learning.
Lesson 9Missing data isn't necessarily random
And this is where the project suddenly returned to my original question about bias.
The words the system couldn't recognise weren't a random sample of Valluvar's vocabulary.
They disproportionately included:
- rare words;
- archaic forms;
- Classical Tamil constructions;
- meanings that have shifted over time.
That creates a dangerous possibility.
Imagine that my tools understand modern-looking words extremely well but systematically fail on older semantic categories.
I build my lexical map.
The map shows modern-looking vocabulary dominating.
I conclude:
“Valluvar preferred these concepts.”
But perhaps Valluvar didn't.
Perhaps my measurement system preferred the words it could recognise.
The apparent pattern would have been introduced by my tools.
Which is particularly awkward when the entire experiment is supposed to measure bias.
Lesson 10Dictionaries aren't neutral either
Even when a dictionary recognises a word, another problem remains.
Meaning changes.
Take:
ஆக்கம் — ākkam
A modern English gloss (Tamil Wiktionary's, for example) can suggest things like:
“creation”, “construction” or “production”.
Those aren't necessarily the senses relevant to the Thirukkural.
In context, the meaning can be closer to:
prosperity, gain, advancement.
If I automatically map an ancient Tamil word through a modern bilingual dictionary, I haven't simply “translated” Valluvar.
I've introduced another interpreter.
And suddenly the pipeline looks like this:
Valluvar
↓
edition
↓
tokenisation
↓
morphological analyser
↓
dictionary
↓
modern English gloss
↓
my statistics
Every arrow represents a decision.
Every decision can alter the thing I'm supposedly measuring.
Lesson 11Keep a lab notebook
At this point I became obsessive about provenance.
The original text is never overwritten.
Tools are versioned.
Sources are checksummed.
Rules are numbered.
Every proposed root retains the source that produced it.
Every run is logged.
This sounded excessive until rebuilding one dictionary tool from its source produced something that was not quite identical to its published version: a few extra internal paths that shouldn't have been there.
Eventually I traced it to a typo in the tool's own word list:
நிப்பாட்டு்
with an extra Unicode mark.
It happened not to affect a single Kural word; the two versions gave identical answers on the whole text.
But that wasn't the point.
Two supposedly identical tools were not, in fact, identical.
Without versioning and provenance, I wouldn't have noticed, let alone known why.
That's reproducibility.
And it is one of the least glamorous and most important parts of serious computational work.
So how much of the Thirukkural can the machine understand?
That depends on what “understand” means.
Using the modern analyser directly against the original metrical text gave me coverage of roughly:
26%.
Fixing the word boundaries using the scholar's edition increased it to around:
48%.
Adding candidate roots and Classical Tamil morphological rules could potentially take coverage into approximately:
78%.
But that final number comes with a giant asterisk.
Many of those additional analyses have not yet been validated by a Classical Tamil expert.
So 78% does not mean:
“78% of the Thirukkural has been correctly lemmatised.”
It means something closer to:
“The current pipeline can propose an analysis for roughly 78% of word occurrences.”
Those are very different claims.
Small manual samples suggest that some automatic categories may be right around 70–80% of the time.
But without a proper expert-labelled test set, I don't yet have a defensible accuracy figure.
And saying that openly is part of the experiment.
I still haven't answered my original question
Remember what I wanted to investigate?
Is Tiruvalluvar biased?
My original plan was:
identify the roots,
count them,
measure which roots occur together,
find unusual linguistic asymmetries,
control for chapter structure,
test whether those asymmetries could plausibly arise by chance,
and only then ask whether any of them might constitute bias.
I haven't reached that experiment.
And I don't think I should.
Not yet.
Because before measuring Valluvar's linguistic choices, I need confidence that I'm actually measuring Valluvar's words.
Before trusting my roots, I need to know how often they're correct.
Before trusting my missing data, I need to understand what kinds of words are missing.
And before claiming that a pattern belongs to Valluvar, I need to establish that the pattern wasn't introduced by the edition, tokenizer, morphological analyser, dictionary or my own rules.
That leads to the next stage.
The machine needs an answer key
The next thing I want to build isn't a more sophisticated model.
It's a carefully selected collection of real Kural word occurrences where Classical Tamil experts independently identify:
- the correct word boundary;
- lemma/root;
- grammatical category;
- relevant morphology;
- and, where necessary, contextual sense.
That becomes the gold standard.
Then I can finally ask meaningful questions about my tools:
How often are they right?
Which kinds of words do they get wrong?
Are my “high confidence” labels actually high confidence?
Do two experts agree?
And most importantly:
Could the errors themselves distort the patterns I eventually want to measure?
Only after answering those questions do I want to return to the statistics.
Perhaps this is what machine learning actually looks like
When I started, I imagined this project would eventually involve embeddings, clustering, networks, statistical tests and perhaps deep-learning models.
Instead I spent most of my time moving spaces around, reading dictionaries, inspecting Unicode characters, writing grammar rules and discovering that a computer thought “will give” meant “tree”.
Strangely, that may have taught me more about machine learning.
A model doesn't encounter reality directly.
It encounters the representation of reality that we construct for it.
Someone collected the data.
Someone decided where one observation ends and another begins.
Someone assigned the labels.
Someone wrote the dictionary.
Someone chose which uncertain examples to discard.
Someone decided what “correct” means.
And if those decisions are wrong, a more sophisticated model doesn't necessarily rescue us.
Sometimes it simply becomes more sophisticated at measuring the wrong thing.
The question has changed
I started with:
Is Tiruvalluvar biased?
I still want to investigate that question.
But I'm no longer comfortable asking a machine to answer it until I understand the machinery through which the question is being asked.
The first bias I encountered in this project wasn't necessarily Tiruvalluvar's.
It was the possibility of bias in the measurement system I was building to study him.
So for now, the more interesting question isn't:
Is Tiruvalluvar biased?
It is:
How would we know?
And that is where the next experiment begins.
Sources and credits
- Word-separated Thirukkural: Dr. P. Pandiyaraja, Tamil Concordance — http://tamilconcordance.in (used for research, with citation, as the site requests).
- Base text: tk120404/thirukkural (Apache-2.0), https://github.com/tk120404/thirukkural
- Morphological analyser: ThamizhiMorph, K. Sarveswaran, G. Dias and M. Butt (Apache-2.0), https://github.com/sarves/thamizhi-morph
- Dictionary glosses: Tamil Wiktionary contributors, https://ta.wiktionary.org (CC BY-SA 4.0).
- Piṅgala Nikandu: Project Madurai e-text, https://www.projectmadurai.org