Sub topic 5
Labelling questions by intent and journey stage
This chapter covers how to label each cleaned question with an intent and a journey stage. It assumes you have already scrubbed personal data and deduplicated your questions, as in the earlier chapters. It also assumes you can read short Python scripts and have a rough idea of how AI assistants answer questions.
Why label at all
After deduplication you have a flat list of questions. A flat list hides three things you need later:
- Which kinds of question dominate. A set with 80% "how do I..." questions tests a different behaviour from one with 80% "which is better..." questions.
- Which stage of the buying or usage journey the question comes from. AI assistants often recommend brands for comparison questions, but rarely for troubleshooting ones. If you mix the two, your results blur.
- Where the set has gaps. You cannot see a missing category if you never named the categories.
Labels also feed the next steps. Topic clustering groups by subject, and intent labels group by purpose. Sampling later uses both, so that you do not accidentally drop every rare but important question type.
Intent and journey stage are different things
Intent describes what the person wants the answer to do. Journey stage describes where they are in their relationship with a product or topic. They are related but not the same. A "how to" question can come from a prospect testing whether your product can do something, or from a customer who has used it for a year.
Keep them as two separate fields. Merging them into one label makes the taxonomy grow quickly and makes disagreements between labellers harder to resolve.
A starter intent taxonomy
Start small. Six to eight intents are enough for most businesses.
| Intent | What the person wants | Example |
|---|---|---|
| `definition` | To understand a concept | What is a shared mailbox? |
| `how_to` | Steps to complete a task | How do I move my subscription to a new email? |
| `comparison` | To choose between options | Is plan A or plan B better for a small team? |
| `recommendation` | A suggestion from an open field | What is the best tool for tracking invoices? |
| `troubleshooting` | To fix something broken | Why does my export keep failing? |
| `pricing_policy` | Cost, terms, refunds, limits | Can I get a refund after 30 days? |
| `availability_fit` | Whether something supports a need | Does it work with Outlook? |
Adjust the names to your domain. Keep the definitions short enough that two people would label the same question the same way.
A starter journey taxonomy
Use four stages unless you have a strong reason to use more.
| Stage | Meaning | Typical signals |
|---|---|---|
| `awareness` | Learning about a problem or category | "what is", "why do", no product named |
| `consideration` | Weighing options | "best", "vs", "alternatives", "worth it" |
| `decision` | Ready to buy or sign up | price, trial, contract, "does it support" |
| `ownership` | Already using it | "how do I", errors, cancelling, upgrading |
The signals are hints, not rules. "Does it work with Outlook?" could be a decision question from a prospect or an ownership question from a customer. When the wording does not settle it, the source can. A question from a support ticket is more likely ownership. A question from a sales call is more likely consideration or decision.
Labelling in practice
You have three realistic options. Most teams combine them.
- Manual labelling. A person reads each question and picks labels. It is slow, but it gives the most reliable result for a small set, and you need it to create a gold standard.
- Rules. Keyword and pattern matching assigns labels cheaply and predictably. It misses unusual phrasings.
- A language model classifier. You give the model your definitions and examples, and it labels in bulk. It is fast and handles odd wording, but it can be inconsistent and it makes confident mistakes.
A sensible workflow is to hand-label a sample of about 100 to 200 questions, build rules or a model prompt, measure it against that sample, then review the disagreements.
A rule-based first pass
This script assigns a first-guess intent and records which rule fired, so you can audit it. It is deliberately simple. Rules are checked in order, so more specific patterns come first.
import re
INTENT_RULES = [
("troubleshooting", re.compile(r"\b(error|fail(s|ed|ing)?|not working|won'?t|can'?t|broken|stuck|why (does|is|won'?t))\b", re.I)),
("pricing_policy", re.compile(r"\b(price|pricing|cost|refund|cancel|trial|free|discount|invoice|billing)\b", re.I)),
("comparison", re.compile(r"\b(vs\.?|versus|compared to|difference between|better than|alternatives? to|or)\b", re.I)),
("recommendation", re.compile(r"\b(best|top|recommend|should i use|which (tool|app|service))\b", re.I)),
("availability_fit", re.compile(r"\b(does it|do you|is there|can it|support|integrat|compatible|work with)\b", re.I)),
("definition", re.compile(r"^(what is|what are|what does|define|meaning of)\b", re.I)),
("how_to", re.compile(r"^(how (do|can|to|should)|steps to|way to)\b", re.I)),
]
def label_intent(text):
for intent, pattern in INTENT_RULES:
if pattern.search(text):
return intent, pattern.pattern
return "unlabelled", None
if __name__ == "__main__":
samples = [
"Why does my export keep failing?",
"Can I get a refund after 30 days?",
"Is plan A or plan B better for a small team?",
"What is a shared mailbox?",
"How do I move my subscription to a new email?",
"Something odd happened with my login",
]
for s in samples:
intent, _ = label_intent(s)
print(f"{intent:16} {s}")Running it labels the first five correctly and returns unlabelled for the last one. That last result is useful. An explicit unlabelled bucket shows you where the rules fail, which is better than forcing a guess.
Note the order matters. "How do I cancel my trial?" matches pricing_policy before how_to. Whether that is right depends on your taxonomy. Decide, write it down, and apply it consistently.
Journey stage from source plus wording
Source is a strong signal for journey stage, so combine it with the wording. This function uses source as the default and lets wording override it.
SOURCE_DEFAULT_STAGE = {
"support_tickets": "ownership",
"sales_calls": "consideration",
"site_search": "awareness",
"community_forum": "ownership",
"reviews": "ownership",
}
DECISION_WORDS = ("price", "pricing", "trial", "contract", "buy", "sign up", "quote")
CONSIDERATION_WORDS = ("best", "vs", "versus", "alternative", "compare", "worth it")
def label_stage(text, source):
lowered = text.lower()
if any(word in lowered for word in DECISION_WORDS) and source != "support_tickets":
return "decision"
if any(word in lowered for word in CONSIDERATION_WORDS):
return "consideration"
return SOURCE_DEFAULT_STAGE.get(source, "awareness")The source != "support_tickets" check reflects a real pattern: a billing question in a support ticket comes from an existing customer, not someone about to buy. Rules like this encode your business knowledge. Review them with someone who handles those conversations.
Storing the labels
Add the labels to each record next to the fields you already have. Keep a field that says how the label was produced, so you can later separate human-checked labels from automatic ones.
{"id":"q-0042","text":"Can I move my subscription to a different email address?","source":"support_tickets","intent":"how_to","stage":"ownership","label_method":"human","cluster":null,"count":37}The cluster field stays empty until the clustering step. Do not overwrite the original text when you label. Labels are metadata about the question, not edits to it.
Handling ambiguity
Real questions do not fit tidy boxes. These cases come up often.
- Multi-intent questions. "What does the Pro plan cost and does it include API access?" is both
pricing_policyandavailability_fit. Pick one primary intent, usually the first clause, and keep an optionalsecondary_intentfield. Do not allow ten labels per question. - Very short queries. Site search often gives "refund" or "outlook export". These have no verb to classify. Label them from the topic if it is clear, or mark them
unlabelledand leave them out of intent-based sampling. - Questions that change meaning by context. "Can I cancel?" may be a policy question or a how-to. Use the source and, if available, the surrounding conversation.
- Statements, not questions. Reviews contain text like "wish it integrated with Outlook". Convert it to a question only if the meaning is clear, and record that you did so.
When you convert a statement, keep the original in the record. Chapter on prompt phrasing covers rewriting in more detail. At this stage you are only deciding whether the item is usable.
Measuring label quality
A label set you have not measured is a guess. Take your hand-labelled sample and compare it with the automatic labels.
from collections import Counter
def agreement(gold, predicted):
pairs = list(zip(gold, predicted))
correct = sum(1 for g, p in pairs if g == p)
return correct / len(pairs)
def confusion(gold, predicted):
return Counter((g, p) for g, p in zip(gold, predicted) if g != p)
gold = ["how_to", "pricing_policy", "comparison", "how_to", "troubleshooting"]
pred = ["how_to", "how_to", "comparison", "how_to", "troubleshooting"]
print(f"agreement: {agreement(gold, pred):.0%}")
for (g, p), n in confusion(gold, pred).most_common():
print(f"gold={g} predicted={p}: {n}")The confusion counts tell you which pair of labels is being mixed up. If how_to and pricing_policy collide often, either your rule order is wrong or the two definitions overlap.
For the human side, have two people label the same 50 questions independently and compare. If they disagree on more than about one in five, the taxonomy definitions need tightening before you automate anything. Automation will not fix an ambiguous taxonomy.
Common errors
- Too many labels. Twenty intents look precise but nobody applies them consistently. Merge until two people agree.
- Labelling by your product's vocabulary. Customers say "my stuff won't load", not "sync failure". Label by what the person wants, not by the internal category your team would use.
- Ignoring
count. A question asked 37 times and one asked once each get one label, but they should not weigh the same later. Keep the count and use it when you report distribution. - Trusting model labels without a check. A classifier that is right 90% of the time on common questions may be wrong on rare ones, and the rare ones are the ones you want to keep.
- Losing the unlabelled items. Dropping them silently skews the set toward questions that happen to be easy to classify. Keep them, and report how many there are.
What you have at the end
You should now have, for every question: an intent, a journey stage, a note of how each was assigned, and an optional secondary intent. You should also have a measured agreement figure for your automatic labels, and a count of unlabelled items. These feed topic clustering and, later, the sampling step that balances demand against coverage.
Exercise
Your rule-based labeller gives "How do I cancel my trial?" the intent pricing_policy, because the pricing rule is checked before the how-to rule. A colleague argues it should be how_to. Name two ways to resolve this, and say what you must do afterwards to keep the set consistent.
Show answer
One option is to reorder the rules so the how_to pattern runs first. Another is to keep the order and add a documented tie-break rule, such as "a question that starts with a how-to phrase is how_to, with the topic recorded in secondary_intent". Either way, write the decision into the taxonomy definitions, re-run the labeller over the full set, and re-measure agreement against the hand-labelled sample. Otherwise some questions follow the old rule and some follow the new one.
Exercise
A question from a support ticket reads "What is your price for the annual plan?" Using the label_stage function above, what stage does it get, and is that likely correct? Explain what the function is assuming.
Show answer
The text contains "price", but the source is support_tickets, so the first check is skipped. No consideration words are present, so the function returns the source default, ownership. This is plausible if the writer is an existing customer asking about renewal or an upgrade. The function assumes ticket authors are existing customers, which is not always true, since prospects sometimes use support channels. If you see this pattern often, review those cases by hand.
Exercise
Two reviewers label the same 50 questions and disagree on 16 of them. Should you start automating the labelling? What do you do first?
Show answer
No. Disagreement on 16 of 50 is 32%, well above the roughly 20% threshold. First, look at which labels they confuse, then tighten those definitions with examples and edge-case rules, or merge labels that overlap. Have the two reviewers label a fresh set of 50 and measure again. Automate only after agreement is acceptable, because an automatic labeller can only be as consistent as the definitions it copies.