Head grammar

From HandWiki
Short description: Concept in generalized context free grammar


Head grammar (HG) is a grammar formalism introduced in Carl Pollard (1984)[1] as an extension of the context-free grammar class of grammars. Head grammar is therefore a type of phrase structure grammar, as opposed to a dependency grammar. The class of head grammars is a subset of the linear context-free rewriting systems.

One typical way of defining head grammars is to replace the terminal strings of CFGs with indexed terminal strings, where the index denotes the "head" word of the string. Thus, for example, a CF rule such as [math]\displaystyle{ A \to abc }[/math] might instead be [math]\displaystyle{ A \to (abc, 0) }[/math], where the 0th terminal, the a, is the head of the resulting terminal string. For convenience of notation, such a rule could be written as just the terminal string, with the head terminal denoted by some sort of mark, as in [math]\displaystyle{ A \to \widehat{a}bc }[/math].

Two fundamental operations are then added to all rewrite rules: wrapping and concatenation.

Operations on headed strings

Wrapping

Wrapping is an operation on two headed strings defined as follows:

Let [math]\displaystyle{ \alpha \widehat{x} \beta }[/math] and [math]\displaystyle{ \gamma \widehat{y} \delta }[/math] be terminal strings headed by x and y, respectively.

[math]\displaystyle{ w(\alpha \widehat{x} \beta, \gamma \widehat{y} \delta) = \alpha x \gamma \widehat{y} \delta \beta }[/math]

Concatenation

Concatenation is a family of operations on n > 0 headed strings, defined for n = 1, 2, 3 as follows:

Let [math]\displaystyle{ \alpha \widehat{x} \beta }[/math], [math]\displaystyle{ \gamma \widehat{y} \delta }[/math], and [math]\displaystyle{ \zeta \widehat{z} \eta }[/math] be terminal strings headed by x, y, and z, respectively.

[math]\displaystyle{ c_{1,0}(\alpha \widehat{x} \beta) = \alpha \widehat{x} \beta }[/math]

[math]\displaystyle{ c_{2,0}(\alpha \widehat{x} \beta, \gamma \widehat{y} \delta) = \alpha \widehat{x} \beta \gamma y \delta }[/math]

[math]\displaystyle{ c_{2,1}(\alpha \widehat{x} \beta, \gamma \widehat{y} \delta) = \alpha x \beta \gamma \widehat{y} \delta }[/math]

[math]\displaystyle{ c_{3,0}(\alpha \widehat{x} \beta, \gamma \widehat{y} \delta, \zeta \widehat{z} \eta) = \alpha \widehat{x} \beta \gamma y \delta \zeta z \eta }[/math]

[math]\displaystyle{ c_{3,1}(\alpha \widehat{x} \beta, \gamma \widehat{y} \delta, \zeta \widehat{z} \eta) = \alpha x \beta \gamma \widehat{y} \delta \zeta z \eta }[/math]

[math]\displaystyle{ c_{3,2}(\alpha \widehat{x} \beta, \gamma \widehat{y} \delta, \zeta \widehat{z} \eta) = \alpha x \beta \gamma y \delta \zeta \widehat{z} \eta }[/math]

And so on for [math]\displaystyle{ c_{m,n} : 0 \leq n \lt m }[/math]. One can sum up the pattern here simply as "concatenate some number of terminal strings m, with the head of string n designated as the head of the resulting string".

Form of rules

Head grammar rules are defined in terms of these two operations, with rules taking either of the forms

[math]\displaystyle{ X \to w(\alpha, \beta) }[/math]

[math]\displaystyle{ X \to c_{m,n}(\alpha, \beta, ...) }[/math]

where [math]\displaystyle{ \alpha }[/math], [math]\displaystyle{ \beta }[/math], ... are each either a terminal string or a non-terminal symbol.

Example

Head grammars are capable of generating the language [math]\displaystyle{ \{ a^n b^n c^n d^n : n \geq 0 \} }[/math]. We can define the grammar as follows:

[math]\displaystyle{ S \to c_{1,0}(\widehat{\epsilon}) }[/math]

[math]\displaystyle{ S \to c_{3,1}(\widehat{a}, T, \widehat{d}) }[/math]

[math]\displaystyle{ T \to w(S, \widehat{b}c) }[/math]

The derivation for "abcd" is thus:

[math]\displaystyle{ S }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, T, \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(S, \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(c_{1,0}(\widehat{\epsilon}), \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(\widehat{\epsilon}, \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, \widehat{b}c, \widehat{d}) }[/math]

[math]\displaystyle{ a\widehat{b}cd }[/math]


[math]\displaystyle{ S }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, T, \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(S, \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(c_{3,1}(\widehat{a}, T, \widehat{d}), \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(c_{3,1}(\widehat{a}, w(S, \widehat{b}c), \widehat{d}), \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(c_{3,1}(\widehat{a}, w(c_{1,0}(\widehat{\epsilon}), \widehat{b}c), \widehat{d}), \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(c_{3,1}(\widehat{a}, w(\widehat{\epsilon}, \widehat{b}c), \widehat{d}), \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(c_{3,1}(\widehat{a}, \widehat{b}c, \widehat{d}), \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, w(a\widehat{b}cd, \widehat{b}c), \widehat{d}) }[/math]

[math]\displaystyle{ c_{3,1}(\widehat{a}, ab\widehat{b}ccd, \widehat{d}) }[/math]

[math]\displaystyle{ aab\widehat{b}ccdd }[/math]

Formal properties

Equivalencies

Vijay-Shanker and Weir (1994)[2] demonstrate that linear indexed grammars, combinatory categorial grammar, tree-adjoining grammars, and head grammars are weakly equivalent formalisms, in that they all define the same string languages.

References

  1. Pollard, C. 1984. Generalized Phrase Structure Grammars, Head Grammars, and Natural Language. Ph.D. thesis, Stanford University, CA.
  2. Vijay-Shanker, K. and Weir, David J. 1994. The Equivalence of Four Extensions of Context-Free Grammars. Mathematical Systems Theory 27(6): 511-546.