Artificial Intelligence & Neural Networks β Expert System and Natural Language Processing, NEC licence examination syllabus (Nepal Engineering Council).
Steps of NLP
The processing pipeline, stage by stage, with what each stage produces.
π Where this lives: open any NLP library β spaCy, Stanford CoreNLP, NLTK β and you will find these stages as named components you can enable, disable and inspect independently. Modern end-to-end models blur the boundaries, but the stages remain the standard way to reason about where a system went wrong: if the parse is broken, the semantics cannot recover, so debugging proceeds down the pipeline. Search "NLP pipeline stages spaCy components".
The five classical steps
The standard NLP pipeline has FIVE STAGES, and this enumeration
is the guaranteed exam question. Each takes the previous stage's
output and adds structure.
1. LEXICAL ANALYSIS (also MORPHOLOGICAL ANALYSIS)
Break the input into tokens and analyse each word's
structure.
ACTIVITIES:
Β· TOKENISATION β split into words and sentences
Β· normalisation β case folding, expanding contractions
Β· STEMMING or LEMMATISATION
Β· morphological decomposition into morphemes
Β· look up each token in the LEXICON to find its possible
parts of speech
WORKED on "The officers issued licences."
tokens: The | officers | issued | licences | .
morphology: officer + -s (plural)
issue + -ed (past)
licence + -s (plural)
lexicon: "The"βDet; "officers"βN; "issued"βV (or Adj);
"licences"βN (or V)
OUTPUT: a token sequence with candidate analyses.
NOTE THAT AMBIGUITY IS ALREADY PRESENT β "issued" could be
an adjective ("the issued licence"), so the next stage must
choose.
2. SYNTACTIC ANALYSIS (PARSING)
Check that the token sequence is grammatical and build a
structure showing the relationships.
Uses a GRAMMAR, typically a context-free grammar:
S β NP VP
NP β Det N
VP β V NP
WORKED PARSE of "The officer issued the licence":
S
ββββββ΄βββββ
NP VP
ββββ΄βββ βββββ΄ββββ
Det N V NP
β β β ββββ΄βββ
The officer issued Det N
β β
the licence
OUTPUT: a parse tree (or a dependency graph).
WHAT THIS STAGE REJECTS: "Officer the licence issued the"
has no valid parse, so it is caught here rather than
producing nonsense downstream.
WHAT IT CANNOT DO: choose between valid parses. "I saw the
man with the telescope" has two, and syntax alone has no
basis for preferring either.
3. SEMANTIC ANALYSIS
Assign meaning to the syntactic structure, and reject
structures that are grammatical but meaningless.
ACTIVITIES:
Β· WORD SENSE DISAMBIGUATION
Β· assigning SEMANTIC ROLES β agent, patient, instrument
Β· building a LOGICAL FORM or filling a frame
Β· SELECTIONAL RESTRICTION checking β does the verb accept
these kinds of argument?
THE CLASSIC EXAMPLE OF WHAT THIS STAGE CATCHES:
"Colourless green ideas sleep furiously." (Chomsky)
Perfectly grammatical β the parser accepts it. Semantic
analysis rejects it: ideas do not sleep, and nothing is
both colourless and green.
WORKED OUTPUT for our sentence:
issue(agent: officer, object: licence,
tense: past, definite: both)
OUTPUT: a meaning representation, independent of the
original wording.
4. DISCOURSE INTEGRATION
Interpret the sentence in the context of the sentences
around it.
ACTIVITIES:
Β· ANAPHORA / PRONOUN RESOLUTION
Β· COREFERENCE β which mentions denote the same entity
Β· connecting to entities introduced earlier
Β· maintaining the topic and the focus
WORKED:
"The officer reviewed Ram's application. She issued
the licence."
Discourse integration determines that "She" = the
officer, not Ram β using gender agreement here, and in
harder cases requiring plausibility.
WITHOUT THIS STAGE each sentence is understood in isolation,
which is the dialogue-system failure noted in the previous
topic.
5. PRAGMATIC ANALYSIS
Determine what was actually MEANT, as opposed to what was
said.
ACTIVITIES:
Β· identifying the SPEECH ACT β is this a statement, a
question, a request, a promise?
Β· recognising INDIRECT requests
Β· applying world knowledge and conversational conventions
WORKED:
"Can you tell me the status of my application?"
Syntactically a yes/no question about ability. Pragmatic
analysis identifies it as a REQUEST FOR INFORMATION, so
the correct response is the status, not "yes".
THIS STAGE IS WHERE THE REPRESENTATION BECOMES AN ACTION.
THE STAGES ARE OFTEN DRAWN AS A STRICT PIPELINE, and that is a
simplification worth flagging: real systems need FEEDBACK. A
semantic failure may indicate the wrong parse was chosen, so the
parser must be able to offer alternatives β which is why
probabilistic parsers rank parses rather than returning one.
Parsing in more detail
PARSING DESERVES EXPANSION because it is the most algorithmically
developed stage.
TWO STRATEGIES, mirroring the search directions of ACtE0902:
TOP-DOWN PARSING β start from S and expand rules until the
input is matched.
β goal-directed: only builds structures the grammar permits
β may explore expansions inconsistent with the actual words
β LEFT RECURSION (NP β NP PP) causes infinite descent
BOTTOM-UP PARSING β start from the words and combine them
into larger constituents.
β never builds anything unsupported by the input
β builds constituents that cannot form part of any complete
parse
THE COMBINATION used in practice: CHART PARSING, which stores
every constituent found in a table so it is never recomputed β
dynamic programming applied to parsing, exactly as variable
elimination is to probability. THE CYK ALGORITHM is the
standard bottom-up chart parser, running in O(nΒ³Β·|G|) for a
sentence of n words:
n = 10 words β 1,000 chart cells
n = 20 words β 8,000
n = 40 words β 64,000
Cubic is entirely practical for sentence-length inputs, which
is why chart parsing made parsing feasible.
HANDLING AMBIGUITY β the practical answer:
PROBABILISTIC CONTEXT-FREE GRAMMARS (PCFG) attach a
probability to each rule, so a parse's probability is the
product of its rules' probabilities and the parser can
return the MOST LIKELY parse.
THE PROBABILITIES ARE LEARNED FROM A TREEBANK β a corpus of
hand-parsed sentences. This is where the statistical turn in
NLP came from: instead of writing preference rules for PP
attachment by hand, count how often each attachment occurs
in real text.
LEXICALISED PCFGs condition on the actual words, because
"eat pizza with a fork" and "eat pizza with anchovies"
attach differently and the difference is entirely lexical.
DEPENDENCY PARSING β the alternative output format:
Instead of nested phrases, link each word directly to its
HEAD with a labelled relation:
issued ββnsubjβββΆ officer
issued ββdobjββββΆ licence
officer ββdetββββΆ The
licence ββdetββββΆ the
β compact, and directly gives the who-did-what-to-whom that
semantic analysis needs
β better suited to languages with free word order
β faster: transition-based dependency parsers run in linear
time
β this is why most modern pipelines produce dependencies
rather than constituency trees.
The pipeline in practice
A FULL WORKED EXAMPLE, tracing one input through all five stages.
INPUT: "Has Ram's licence been issued yet? He applied last
month."
STAGE 1 β LEXICAL
tokens: Has | Ram | 's | licence | been | issued | yet | ? |
He | applied | last | month | .
morphology: "Ram's" β Ram + possessive
"issued" β issue + past participle
"applied" β apply + past
two sentences identified, by the ? and the .
STAGE 2 β SYNTACTIC
sentence 1 parses as a yes/no question:
Aux(Has) NP(Ram's licence) VP(been issued yet)
sentence 2 parses as a declarative:
NP(He) VP(applied last month)
STAGE 3 β SEMANTIC
sentence 1: issued(object: licence_of(Ram), state: query,
time: up_to_now)
sentence 2: apply(agent: X, time: last_month)
NOTE THE X β the agent of "applied" is not resolved yet,
because "He" is a pronoun and pronouns are the next stage's
business.
STAGE 4 β DISCOURSE
"He" must be resolved. Candidates: Ram. Gender agrees, and
Ram is the only person mentioned.
X = Ram
Also: "last month" is resolved against the current date to
an actual month, and "licence_of(Ram)" is linked to a
specific application record.
STAGE 5 β PRAGMATIC
Sentence 1 is syntactically a yes/no question but is
pragmatically a REQUEST FOR THE STATUS. Answering "no" alone
would be technically correct and unhelpful.
Sentence 2 is not a bare statement of fact β it functions as
JUSTIFICATION for the enquiry, implying "enough time has
passed that I expect an answer".
THE APPROPRIATE SYSTEM RESPONSE therefore includes the status
AND an expected date, because the pragmatic analysis
identified an implicit concern about delay.
NOTE WHAT THE LAST STAGE ADDED: nothing about the words, and
everything about what to DO. That is why pragmatics is the
stage that connects understanding to action.
WHERE THE PIPELINE FAILS, in order of frequency:
Β· TOKENISATION on real-world text β URLs, code, mixed
scripts, emoji, no spaces after punctuation
Β· PARSING long sentences with several attachment ambiguities
Β· COREFERENCE, which remains genuinely hard and is where
world knowledge is unavoidable
Β· PRAGMATICS, which is barely attempted in most deployed
systems β hence assistants that answer the literal
question
AND THE MODERN COMPLICATION worth knowing: LARGE PRE-TRAINED
MODELS DO NOT IMPLEMENT THESE STAGES EXPLICITLY. A transformer
maps text to text with no identifiable parser inside, and probing
studies find that syntactic information is present in its
internal representations without having been designed in. THE
STAGES REMAIN THE RIGHT ANALYSIS OF THE PROBLEM even where they
are not the architecture of the solution β which is why they are
still taught, and still how you diagnose what a system got
wrong.
"Colourless green ideas sleep furiously" is the standard demonstration of why the stages are separate: the parser accepts it because it is perfectly grammatical, and only semantic analysis rejects it. Grammaticality and meaningfulness are independent properties, which is why syntax cannot be the last word.
π Go further: the modern complication is worth pursuing, because it changes what these stages are for. Probing studies take a trained transformer, freeze it, and train small classifiers on its internal activations to test whether syntactic information β part of speech, dependency relations, even approximate parse trees β is recoverable. It largely is, despite nobody having designed a parser into the model. That does not mean the stages are obsolete; it means they describe the problem structure so well that a system learning from raw text rediscovers something like them. Search "probing BERT syntax structural probes".
π‘ Exam angle: name and describe all five steps β lexical/morphological, syntactic, semantic, discourse integration, pragmatic β with the activities and an example for each; this is the most reliably asked question in the NLP part of the syllabus. Give "Colourless green ideas sleep furiously" as what semantic analysis rejects and syntax accepts, and an anaphora example for discourse. Compare top-down and bottom-up parsing with their drawbacks, and explain chart parsing and the CYK O(nΒ³) bound. Know that PCFGs resolve parse ambiguity using probabilities learned from a treebank, and that dependency parsing is the common modern alternative.
Syllabus points
Phases: lexical, syntactic, semantic, etc.
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.
Related topics in Expert System and Natural Language Processing