0% found this document useful (0 votes)
24 views35 pages

Arabic Syntax and Parsing Techniques

The document outlines a lecture on Natural Language Processing focusing on syntax, specifically parsing techniques and the use of Probabilistic Context-Free Grammar (PCFG) to address ambiguity in Arabic sentences. It includes examples of sentence derivations, parse trees, and the sources of ambiguity such as free word order, attached pronouns, and hidden pronouns. Additionally, it discusses methods for tracking search space in parsing and illustrates the application of PCFG through various examples.

Uploaded by

dw9324764
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views35 pages

Arabic Syntax and Parsing Techniques

The document outlines a lecture on Natural Language Processing focusing on syntax, specifically parsing techniques and the use of Probabilistic Context-Free Grammar (PCFG) to address ambiguity in Arabic sentences. It includes examples of sentence derivations, parse trees, and the sources of ambiguity such as free word order, attached pronouns, and hidden pronouns. Additionally, it discusses methods for tracking search space in parsing and illustrates the application of PCFG through various examples.

Uploaded by

dw9324764
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Year: 2024-2025

Spring Semester

Natural Language
Processing
Dr. Wafaa Samy
Dr. Hanaa Eissa
Syntax (Part 4)

Lecture (12)

2
Contents
• Parsing (Cont.)
• Probabilistic Context-Free Grammar
(PCFG)
• Sources of Ambiguity of Arabic Sentences

3
Example (1)
S  NP VP
NP  Pronoun | Proper-Noun | Det Nominal
Nominal  Noun Nominal | Noun
VP  Verb | Verb NP | Verb NP PP | Verb PP
PP  Preposition NP

4
Example (1): Sample Lexicon

5
Example (1) (Cont.)
• This grammar can be used to generate sentences of a
language as:
S ⇒ NP VP Parse Tree
⇒ Pronoun VP
⇒ I VP
⇒ I Verb NP
⇒ I prefer NP
⇒ I prefer Det Nominal
⇒ I prefer a Nominal
⇒ I prefer a Noun Nominal
⇒ I prefer a morning Nominal Nominal
⇒ I prefer a morning Noun
⇒ I prefer a morning flight Noun

Derivation flight
6 I prefer a morning flight.
Example (2)
• Use the following grammar to find a derivation and
parse tree for the following sentence:
does this flight include a meal?

7
Example (2) (Cont.)
S ⇒ Aux NP VP Derivation
⇒ does NP VP
⇒ does Det Nominal VP
⇒ does this Nominal VP
⇒ does this Noun VP
⇒ does this flight VP
⇒ does this flight Verb NP
⇒ does this flight include NP
⇒ does this flight include Det Nominal
⇒ does this flight include a Nominal
⇒ does this flight include a Noun
⇒ does this flight include a meal

does this flight include a meal?


8
Example (2) (Cont.)
Parse Tree

does this flight include a meal?


9
Control
• Of course, in both cases of Top-down parsing and
Bottom-up parsing, we left out how to keep track of the
search space and how to make choices:
o Which node to try to expand next.
o Which grammar rule to use to expand a node.
• One approach is called backtracking.
o Make a choice, if it works out then fine.
o If not then back up and make a different choice.
 Same as with ND-Recognize.

10
Top-Down (Depth-First) Parsing

Depth-First Expansion: Expand a particular node


at a level, only considering an alternate node at
that level if the parser fails as a result of the
11
earlier expansion. i.e., expand the tree all the way
down until you can’t expand any more.
Top-Down (Breadth-First) Parsing

Breadth-First Expansion: All the nodes at each level are expanded once
12 before going to the next (lower) level.
o This is memory intensive when many grammar rules are involved.
What if there are multiple Legal
Parses?
Structural Ambiguity

13
Probabilistic Context-Free Grammar
(PCFG)

14
A PCFG Example
Grammar Lexicon

15
A PCFG Example (Cont.)

16
Deriving a PCFG from a Corpus

17
Example (3)
• Two parse trees for the sentence: Book the dinner flight.
• Use the Probabilistic Context Free Grammar to solve the ambiguity.

18
Example (3) (Cont.)
The Left Tree The Right Tree

19
Example (3) (Cont.)
• The probability of each tree can be computed by multiplying
the probability of each of the rules used in the derivation.

20
Example (4)
• Use the following Grammar rules:

21
Example (4) (Cont.)
• Two parse trees for the sentence: People fish tanks with rods.
• Use the Probabilistic Context Free Grammar to solve the ambiguity.

22
Example (4) (Cont.)
• Two parse trees for the sentence: People fish tanks with rods.
• Use the Probabilistic Context Free Grammar to solve the ambiguity.

23
Example (4) (Cont.)
Tree Probabilities

24
Example (5)

25
Example (5) (Cont.)

26
Example (5): Probabilities

27
Sources of Ambiguity of Arabic
Sentences
• Arabic sentences have the following basic
sources of ambiguity:
o Free word order.
o Attached pronouns.
o Hidden pronouns.

28
Free Word Order
• SVO, VSO, VOS are all acceptable sentence
structures:
‫ أك َل الول ُد التفاحة‬VSO
V: Verb
َ‫ الول ُد أك َل التفاحة‬SVO S: Subject
َ
‫ أك َل التفاحة الول ُد‬VOS
O: Object

• This flexibility in word order may require adding


large number of rules in context-free grammar for
Arabic to handle all different orders.
29
Note
• Arabic has sentences without verbs at all, such as:
o ‫ الشمس مشرقة‬- )nominal sentence in present tense).
The sun is bright

o ‫ كان الرجل كریما‬- (nominal sentence in past tense).

The man was generous

• Note that this type of nominal sentences assumes the


present tense (i.e. there is an implicit copula verb ‘is' as in first
example), unless explicitly specified by some other way such
as incomplete verbs such as (was( ‫ كان‬as in second example.

30
Attached Pronouns
• In Arabic sentence, the subject or object or
both can be attached to the verb.
• So complete sentences can be composed of
what seems to be a single word.
• For example, the one word:
‫اعطیتمونیھا‬
I give it to her
• Contains a complete syntactic structure.
31
Hidden Pronouns
• Arabic is a pro-drop (pronoun-dropping) language, where the
subject of a verb may be implicitly encoded in the verb
morphology.
• For example:
‫ شرب الماء‬: drank-[he] the-water, where the verb ‫ شرب‬encodes
the third Person Masculine Singular.

• Note that this sentence is ambiguous and has two meanings:


‫َرب الما َء‬
َ ‫ش‬
He drank the water (active voice)
‫رب الما ُء‬
َ ‫ش‬ُ
The water is drunk (passive voice)
32
Question (1)
• For the grammar given below, find out the context free
language.
• The grammar G = ({S}, {a, b, c}, P, S) with the productions are:
S → aSa (Rule: 1)
S → bSb (Rule: 2)
S→ c (Rule: 3)

33
Question (1): Solution
• For the grammar given below, find out the context free
language.
• The grammar G = ({S}, {a, b, c}, P, S) with the productions are:
S → aSa (Rule: 1)
S → bSb (Rule: 2)
S→ c (Rule: 3)

L(G) = {c , aca , bcb , aacaa , abcba , bbcbb , bacab , ….}

L(G) = {wcwR : w ∈ {a, b}*}

34

You might also like