AAmit’s LibraryLEARN · PRACTISE · REFLECT

BCA

NLP and text mining: language, representation and business work

Study map: Original foundation and applied business–computing lesson; related subjects, not a claim of complete unit coverage

Natural language processing uses computational methods to work with text or speech. Text mining investigates patterns and information in collections of text. Tasks include classification, extraction, search, summarisation and generation. Each task needs a definition of success and an assessment of errors. A support-routing classifier differs from a system generating a customer response.

1. Define the language task and its consequences

Natural language processing uses computational methods to work with text or speech. Text mining investigates patterns and information in collections of text. Tasks include classification, extraction, search, summarisation and generation. Each task needs a definition of success and an assessment of errors. A support-routing classifier differs from a system generating a customer response.

Identify the language, domain, unit of analysis and workflow. A sentence may need surrounding conversation to be interpreted correctly. Names, abbreviations and mixed-language text can challenge general assumptions. Establish permissions and suitable handling for the source material. Public availability does not automatically make every reuse appropriate. Use synthetic or clearly suitable open text for learning.

Further reading: Hugging Face LLM course

2. Compare representations and baselines

Tokenisation divides text into units chosen by a method. Simple approaches can represent documents through word counts or weighted terms; learned representations can encode relationships useful to a task. The representation shapes what the model can observe. Removing every rare term may discard a critical product code, while aggressive normalisation may erase meaningful distinctions.

Begin with a transparent baseline such as a keyword rule or linear classifier. Compare it with a more complex method using appropriate held-out data. Split related conversations or duplicates carefully to avoid leakage. Examine performance by language and case type. A single average can hide poor handling of rare, consequential requests. Complexity is justified by useful evidence, not by the popularity of a model family.

Further reading: Dive into Deep Learning

Optional companion reading: Public lesson: how tokenizers divide text. Split “refunds” into words, then sketch a possible subword split. Explain why a real tokenizer might segment it differently. You can do this on paper.

3. Evaluate generation differently from classification

A generated answer can be fluent and still unsupported. Retrieval can supply relevant source passages, but it does not guarantee that a generated statement follows from them. Evaluate factual support, completeness, task fit and the ability to abstain. Distinguish the information retrieved from the reasoning or wording added by the model.

For customer communication, define approval and escalation responsibilities. Sensitive commitments should not emerge from an unrestricted generator. Test difficult cases, ambiguous requests and misleading input. Record model and prompt versions so changes can be evaluated. People provide domain judgement and accountable review, while computers can support search, drafting and routine organisation under clear boundaries.

Further reading: NIST AI RMF Generative AI Profile

4. Connect the model to an operating result

A classifier’s value depends on what happens after its prediction. Compare routing errors, review effort, response time and customer outcomes. A highly accurate model may still overload a specialist team or fail on the cases that matter most. Establish a correction mechanism and use feedback to understand changing language and policy.

For study, create synthetic support messages and compare a keyword baseline with a small statistical model. Analyse confusion by class and inspect errors. Then design a reviewed summarisation workflow using a fixed set of source documents. Explain what evidence supports the output and where a person must decide. This builds a path from introductory NLP to deeper models without treating generation as a universal replacement for judgement.

Further reading: Hugging Face LLM course

Study this subject through the nine question words

Who: Who owns labels and reviews outputs?

Whom: Whom does a language error affect?

Whose: Whose text and permissions are involved?

What: What task and error consequences are defined?

Where: Where does context alter meaning?

When: When should the system abstain?

Why: Why is the representation suitable?

Which: Which baseline and subgroup checks matter?

How: How will output become a controlled business action?

Routing accuracy with a consequential minority class

Create 100 synthetic messages: 90 routine and 10 urgent. A classifier predicting routine every time achieves 90% accuracy but urgent recall is zero. A second model detects eight urgent messages and falsely labels six routine messages urgent: urgent precision is 8/14, about 57.1%, and recall is 8/10, or 80%. Write the confusion table and explain why neither accuracy nor recall alone decides whether the routing policy is useful.

Keep related messages in the same train or test partition so repeated conversations do not leak across the split. Review mixed-language, negated and ambiguous requests separately. Compare the keyword baseline with the second model using specialist review capacity and the cost of missed urgency. Classification evidence does not validate a generated reply; require source-supported statements and abstention for uncertain commitments.

Undergraduate work should calculate the table and inspect individual errors. Postgraduate work should compare thresholds and downstream workload against a stated service objective. Research should justify sampling, independent annotation and uncertainty estimates, then assess whether gains persist on a later period rather than claiming general effectiveness from one synthetic corpus.

Study questions and answers

Why does fluent text not establish factual correctness?

Language generation can produce plausible wording without reliable support from the relevant evidence.

Extended practice questions

Explain why text classification requires a business definition of the target label.

A label such as complaint or urgent must have a specified meaning and consistent examples before a model can be evaluated. The same phrase may express a question, irony or dissatisfaction depending on context. Document how annotators handle ambiguity, missing context and multiple concerns, and identify what action follows a label. Computing can find language patterns but does not independently determine the organisation response policy. A classifier is useful only when the label, evidence and workflow fit the intended task, including a correction route for unsuitable predictions.

Marking guide: Label meaning; ambiguity/context; annotations; downstream action; correction. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.

Marks: 10

Ten messages are genuinely urgent. A classifier flags eight messages, six of which are urgent. Calculate precision and recall.

Precision is six genuine urgent messages divided by eight flagged messages, giving 75%. Recall is six detected urgent messages divided by ten genuine urgent messages, giving 60%. Two flagged messages are false positives, and four genuine urgent messages are missed. The total message count is not given, so overall accuracy cannot be calculated. Define urgent and review label quality before interpreting these values. The consequences of a missed urgent case and an unnecessary review may differ substantially, so the two metrics need task context rather than a single success label.

Marking guide: 75/60%; twofalse/fourmissed; noaccuracydenominator; errorcostcontext. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.

Marks: 10

Critique interpreting a sentiment score as a complete measure of customer experience.

A sentiment score concerns a model interpretation of text, not every aspect of the customer experience. It may miss irony, multilingual expression, practical resolution or a customer who never writes a review. Examine the population, label method and whether the score relates to the actual decision. Combine suitable text evidence with accepted service outcomes and direct feedback where appropriate. A high average can hide serious cases affecting a smaller group. Automation should support investigation and response, not assign emotional certainty or close a complaint merely because a score looks positive.

Marking guide: Text versus experience; language/nonresponse; subgroup issues; outcomes; response responsibility. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.

Marks: 10

Frame research on human review of multilingual complaint classifications.

Ask how model recommendations affect reviewers accuracy, workload and response quality across defined language groups. Use appropriately labelled examples with a review protocol and compare assisted and unassisted conditions where feasible. Record language familiarity and case difficulty. Observe whether reviewers question errors or defer to apparently confident output. The contribution could explain when assistance improves interpretation and when it amplifies misunderstanding. Preserve appropriate handling of personal text and state that a retrospective study does not establish safe performance for every language, customer group or live response situation.

Marking guide: Groups/labels; comparison/outcomes; familiarity; deference/errors; data/transfer limits. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.

Marks: 10

The keyword report counts “late” in “not late”. Can it classify the complaint as delayed?

No. The supplied tokenizer counts words without modelling negation or meaning. The word late is evidence of a token occurrence, not evidence that a delay happened. Inspect the sentence and context, retain a human review route and avoid converting frequency into an automatic service decision. Describe the preprocessing and language coverage, including the ASCII limitation. Customer service validates interpretation while analytics documents counting. If a richer classifier is proposed, evaluate it on reviewed examples containing negation and other relevant failure cases before claiming an improvement.

Marking guide: Occurrence versus meaning;negation;human review;coverage and evaluation.

Compare keyword frequency with multinomial naive Bayes classification.

Keyword frequency summarises token occurrences under a declared preprocessing rule and has no trained class decision. The supplied naive Bayes classifier learns class priors and token counts from labelled training messages and uses smoothed likelihoods to choose a class. Neither implementation understands language generally. Frequency can miss context, and naive Bayes makes simplifying assumptions about token contributions. Unknown tokens are ignored in this classifier. Choose the technique according to the question and evaluate interpretation or classification with appropriate reviewed evidence rather than treating sophistication as proof of usefulness.

Marking guide: Descriptive versus fitted;label requirements;smoothing/unknowns;limits and objective.

For “late late refund refund pending”, list the top three frequency results with alphabetical ties.

Tokenisation yields late,late,refund,refund,pending. Counts are late2,refund2,pending1. Sorting by decreasing frequency and then alphabetical token gives(late,2),(refund,2),(pending,1). The alphabetical rule resolves the tie reproducibly; it does not mean late is a more important business concern than refund. The fixture treats this as one input text, not a document-frequency calculation across separate messages. Retain the collection boundary and preprocessing description before using the list to guide inspection of customer records.

Marking guide: Counts2/2/1;ordering;tie not importance;collection boundary.

How should unfamiliar text be handled in a pilot of the supplied text classifier?

The current code ignores tokens outside its training vocabulary. If all tokens are unseen, class priors decide, with class0 winning an equal-prior tie. Disclose this behaviour and add an operational review route for unfamiliar or ambiguous messages rather than assuming a confident meaning. Record language and vocabulary coverage, inspect failures and evaluate a relevant held-out set. Customer service owns escalation and label review; analytics tracks representation and performance. An expanded vocabulary or model requires fresh evaluation. The small fixture contains no calibrated probability or uncertainty threshold.

Marking guide: Unknown-token behaviour;tie/prior;human escalation;coverage/evaluation;no calibration claim.

Revision cards

Explain why text classification requires a business definition of the target label.

Define text labels, ambiguity handling and resulting actions before evaluation; language patterns alone do not determine a business response.

Ten messages are genuinely urgent. A classifier flags eight messages, six of which are urgent. Calculate precision and recall.

Precision 75%, recall 60%; two false alerts and four missed urgent messages. Overall accuracy needs total-case information.

Why retain a human correction route for text classification?

Language is contextual and categories can be wrong, especially for ambiguous or unfamiliar cases. Review consequential errors, preserve correction reasons and avoid treating a predicted label as the customer’s complete meaning.

Why do keyword counts not prove sentiment or intent?

Negation, context, sarcasm and mixed statements can change meaning. Test against labelled examples appropriate to the task. A word’s frequency is a signal, not a complete interpretation of a conversation.

Why preserve an ambiguous label during text review?

Some comments express several concerns or lack enough context. Record uncertainty or a multi-label interpretation where appropriate rather than forcing a false certainty. Review consequential cases with the relevant human evidence.

What can happen when label definitions change without versioning?

Historical and new counts can become incomparable because the same words are classified differently. Keep the definition and model version linked to results, and explain the effect before claiming a real change in customer needs.

Why inspect examples within an automatically discovered topic?

A topic label may combine unrelated uses of similar words or obscure minority concerns. Read representative and difficult examples before treating the cluster as an established business problem or strategic priority.

Practice task

Build a synthetic support corpus with ambiguous and mixed-language cases. Compare a baseline, inspect errors and design a human-reviewed text workflow with explicit abstention.

Sources and further reading

  • Hugging Face LLM course
    Type: Free course; computing costs depend on execution
    Use: Transformers, datasets, tokenisation and model training
  • Dive into Deep Learning
    Type: Free interactive textbook
    Use: Neural networks, optimisation, attention and applications
  • An Introduction to Statistical Learning
    Type: Free author-hosted PDF editions; print books separate
    Use: Regression, classification, resampling, regularisation and model comparison
  • NIST AI RMF Generative AI Profile
    Type: Free official voluntary risk-management profile
    Use: Study confabulation and evaluation limits for generated outputs; not a certification.

Related courses

Open interactive reading and progress tools