CSC266 Artificial Intelligence

Artificial IntelligenceTU Board 2079

How syntactic and semantic analyses are performed in natural language processing?

Answer

Natural language processing (NLP) understands a sentence in stages: lexical analysis, syntactic analysis, semantic analysis, discourse integration and pragmatic analysis.

Syntactic analysis (parsing)

Syntactic analysis checks whether the words form a grammatically correct sentence and finds its structure.

  1. The sentence is split into words (tokens), and each word gets its part of speech (noun, verb, determiner and so on) from a lexicon.
  2. A grammar, usually a context-free grammar, describes valid sentences, for example: S → NP VP, NP → Det N, VP → V NP.
  3. A parser (top-down, bottom-up or chart parser) uses the grammar to build a parse tree. If no parse tree exists, the sentence is ungrammatical.

Example: "The boy eats an apple" → S [ NP (The boy) VP (eats NP (an apple)) ]. "Boy the apple an eats" fails to parse.

Semantic analysis

Semantic analysis finds the meaning of the parsed sentence and checks that it makes sense.

  1. Each word is mapped to its meaning using the lexicon, and word-sense ambiguity is resolved from context (for example, "bank" of a river vs a money bank).
  2. The meanings are combined following the parse tree (compositional semantics) into a formal representation such as first-order logic, a semantic network or frames: eats(boy, apple).
  3. Selectional restrictions reject meaningless sentences: "Colourless green ideas sleep furiously" is grammatical but has no sensible meaning, because ideas cannot sleep.

The output of semantic analysis is a meaning representation that the system can reason with or act on.

Discussion

Loading…

More Artificial Intelligence questions

All Artificial Intelligence old questions