10 Real-World Applications of Natural Language Processing

A spam filter returns a label. A search engine returns a list. A summarizer writes new text. All three use natural language processing (NLP), but a test that makes sense for one can be useless…

A spam filter returns a label. A search engine returns a list. A summarizer writes new text. All three use natural language processing (NLP), but a test that makes sense for one can be useless for another. Start with the output someone needs, then decide what would make that output wrong.

For a developer, an NLP task is a little like a function signature: text goes in, and a label, span, ranking, or new passage comes out. The analogy breaks at correctness. Two translations can both be valid, while a single wrong number can invalidate an otherwise fluent summary.

Ten NLP applications: input, output, and a useful test

Examples and evaluation questions, not product benchmarks
ApplicationExample inputExpected outputWhat to measure
Spam filteringEmail subject and bodySpam or not spamOf the messages blocked, how many were actually spam? Also track missed spam.
TranslationA delivery notice in SpanishThe same notice in EnglishHave a bilingual reviewer check dates, amounts, and negations. Fluency alone is not accuracy.
Voice assistants“Set a timer for fifteen minutes”Timer action with duration = 15 minutesScore the final action and duration. Correct words are not enough if the timer is wrong.
Document analysisA contract clause naming the supplierThe supplier name and its exact location in the textCompare both the text span and the entity type against a labeled example.
Search“How do I return a damaged item?”A ranked list of help articlesMeasure how often a useful answer appears in the first three results.
Predictive text“I will send the”A short list of possible next wordsOn held-out messages, count how often the actual next word appears in the top three.
SummarizationA transcript of a support callA short account of the problem and next actionFlag unsupported claims and omitted commitments against the transcript.
Sentiment analysis“Great screen, but the battery dies by noon.”Positive about the screen; negative about the batteryScore labels separately by aspect. A single overall label would conceal the complaint.
Customer-service chatbotsA refund question and the applicable policyA response or a handoff to an agentCount grounded, correct resolutions; also test requests that should trigger a handoff.
Social listeningA batch of public product mentionsGroups of recurring issuesSample each group and count relevant mentions. Remove duplicates before interpreting a spike.

A worked example: the cost of filtering the wrong email

Suppose a filter blocks 16 messages in a labeled sample of 100. Of those 16, 12 are spam and four are legitimate. Another eight spam messages pass through. Precision is 12/16 = 75%: one in four blocked messages did not belong in the spam folder. Recall is 12/20 = 60%: the filter caught three in five spam messages. These are illustrative counts, not measured performance for a particular service.

If a missed invoice is costly, quarantine borderline messages for review instead of deleting them. If too much spam still reaches readers, test a different threshold and count how many additional legitimate messages it would catch. The scikit-learn guide to precision and recall defines the two measures. Neither tells you which trade-off your users will accept.

When a label is not enough: extraction and generation

In “Ship to New York on Friday,” a document processor may need the exact span New York, labeled as a place. Returning only York fails an exact-match test even though it looks close. Marking places is one of several types of linguistic annotation. Before evaluating a model, define how people should annotate entities so that reviewers agree on the boundaries. Then test entity extraction on text that was not used to write the rules or train the model. The spaCy span scorer reports precision, recall, and F-score for spans.

Generation needs a different check. A call summary that changes “refund requested” to “refund approved” can read perfectly and still be wrong. Give the reviewer the transcript alongside the summary, and ask which sentence supports each claimed action. For how generating a passage differs from selecting a label, see natural language generation. For a voice interface, test speech recognition separately from the action taken: a mistranscription and a misinterpreted command need different fixes.

Choose the cheapest test that exposes a costly error

Keep a small test set with examples of what must not happen: a legitimate email blocked, a company name cut in half, or a refund promised without evidence. Include ordinary cases as well, and keep examples from the same conversation on the same side of the training/test split. Start with the simplest workable rule or search system. Add a model only when it improves the outcomes you care about on held-out examples.

Further reading

If you want to implement several of these tasks with transformer models, Natural Language Processing with Transformers is a practical companion. You do not need the book to use the evaluation checklist above.

As an Amazon Associate I earn from qualifying purchases.

View the revised edition on Amazon US (paid link).