NLP
Nepali Tokenisation and Embeddings: Preparing Text for NLP
Krishna Mishra connects his public Nepali tokenizer artifact with practical decisions about Unicode, subword tokens, embeddings and language-model evaluation.
Text preparation is part of the model interface
My Hugging Face profile includes a public Nepali Tokenizer repository. I am Krishna Mishra, founder of AI Automation Nepal, and this artifact is part of my NLP portfolio alongside transformer sentiment analysis and character recognition. A published tokenizer is inspectable work; it is not by itself a benchmark showing superiority over every other Nepali tokenizer.
Tokenisation converts text into units used by a model. Embeddings represent those units or larger pieces of text numerically. The two concepts are connected but distinct. A tokenizer should match the model that consumes its output, and the representation should be evaluated for the actual task rather than chosen solely because it has a familiar name.
Keep preprocessing sensitive to meaning
My NLP notes cover HTML cleanup, whitespace, punctuation, negation and multiple tokenisation approaches. These are choices rather than a mandatory checklist. Removing a negative word, an emoji or a number may remove information needed to interpret a review, an amount or an enquiry. Decide what to preserve from the task’s requirements.
Nepali text also needs care with Unicode and mixed-language input. Test representative spellings, punctuation and Romanised Nepali where relevant. Normalisation should be consistent between training and inference. A transformation that looks harmless in a short example can change text offsets or remove distinctions needed by an extraction task.
Compare representations on the same task
Bag-of-words and TF-IDF provide useful classical baselines. Learned word embeddings and contextual transformer representations offer different trade-offs. No representation is universally best regardless of data, language, compute and evaluation. Compare candidates on the same split and metric rather than presenting a historical note’s preference as a guaranteed rule.
Subword approaches such as BPE, WordPiece and SentencePiece-related tokenisation can handle text at a different granularity from whole-word splitting. The exact vocabulary and normalisation still matter. Inspect sequence lengths and representative outputs, and check what happens to unfamiliar words before choosing limits for an application.
Inspect an input before and after tokenisation
For an illustrative test, compare a short Devanagari sentence, a mixed Nepali-English sentence and a Romanised variant expressing a similar request. Inspect the token IDs and decoded text using the intended tokenizer. Record the length and truncation policy. The goal is to understand what the model receives, not to assume the shortest token sequence is always best.
If a preprocessing step changes the text, keep that transformation consistent with any entity offsets or source references. For a classifier, compare predictions with and without the transformation on a fixed evaluation set. For retrieval, test whether the relevant document is found for the actual query wording.
A shared semantic meaning does not guarantee identical tokenisation or embeddings across languages. Use task-level evidence to decide whether normalisation, a different tokenizer or a different model helps. My public tokenizer artifact provides something to inspect; a new multilingual application needs its own language and domain evaluation.
Carry the configuration into deployment
Save tokenizer files, special-token settings and model configuration together. A changed vocabulary or unexpected truncation can alter predictions after deployment. For retrieval, check that document and query representations use compatible settings. Similarity is a retrieval signal, not proof that the retrieved passage correctly answers the question.
Through AI Automation Nepal, I connect language-processing discussions with useful software and reviewed workflows. Explore the public tokenizer and NLP project links, then define the target language, sample inputs and acceptance criteria. This guide explains the engineering choices without claiming that every studied technique has been deployed as a separate commercial product.