Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Generalized context-free grammar

From Wikipedia, the free encyclopedia
(Redirected fromLinear context-free rewriting language)
Abstract language theory concept

Generalized context-free grammar (GCFG) is a grammar formalism that expands oncontext-free grammars by adding potentially non-context-free composition functions to rewrite rules.[1]Head grammar (and its weak equivalents) is an instance of such a GCFG which is known to be especially adept at handling a wide variety of non-CF properties of natural language.

Description

[edit]

A GCFG consists of two components: a set of composition functions that combine string tuples, and a set of rewrite rules. The composition functions all have the formf(x1,...,xm,y1,...,yn,...)=γ{\displaystyle f(\langle x_{1},...,x_{m}\rangle ,\langle y_{1},...,y_{n}\rangle ,...)=\gamma }, whereγ{\displaystyle \gamma } is either a single string tuple, or some use of a (potentially different) composition function which reduces to a string tuple. Rewrite rules look likeXf(Y,Z,...){\displaystyle X\to f(Y,Z,...)}, whereY{\displaystyle Y},Z{\displaystyle Z}, ... are string tuples or non-terminal symbols.

The rewrite semantics of GCFGs is fairly straightforward. An occurrence of a non-terminal symbol is rewritten using rewrite rules as in a context-free grammar, eventually yielding just compositions (composition functions applied to string tuples or other compositions). The composition functions are then applied, successively reducing the tuples to a single tuple.

Example

[edit]

A simple translation of a context-free grammar into a GCFG can be performed in the following fashion. Given the grammar in (1), which generates the palindrome language{wwR:w{a,b}}{\displaystyle \{ww^{R}:w\in \{a,b\}^{*}\}}, wherewR{\displaystyle w^{R}} is the string reverse ofw{\displaystyle w}, we can define the composition functionconc as in (2a) and the rewrite rules as in (2b).

Sϵ | aSa | bSb{\displaystyle S\to \epsilon ~|~aSa~|~bSb}1
conc(x,y,z)=xyz{\displaystyle conc(\langle x\rangle ,\langle y\rangle ,\langle z\rangle )=\langle xyz\rangle }2a
Sconc(ϵ,ϵ,ϵ) | conc(a,S,a) | conc(b,S,b){\displaystyle S\to conc(\langle \epsilon \rangle ,\langle \epsilon \rangle ,\langle \epsilon \rangle )~|~conc(\langle a\rangle ,S,\langle a\rangle )~|~conc(\langle b\rangle ,S,\langle b\rangle )}2b

The CF production ofabbbba is

S
aSa
abSba
abbSbba
abbbba

and the corresponding GCFG production is

Sconc(a,S,a){\displaystyle S\to conc(\langle a\rangle ,S,\langle a\rangle )}
conc(a,conc(b,S,b),a){\displaystyle conc(\langle a\rangle ,conc(\langle b\rangle ,S,\langle b\rangle ),\langle a\rangle )}
conc(a,conc(b,conc(b,S,b),b),a){\displaystyle conc(\langle a\rangle ,conc(\langle b\rangle ,conc(\langle b\rangle ,S,\langle b\rangle ),\langle b\rangle ),\langle a\rangle )}
conc(a,conc(b,conc(b,conc(ϵ,ϵ,ϵ),b),b),a){\displaystyle conc(\langle a\rangle ,conc(\langle b\rangle ,conc(\langle b\rangle ,conc(\langle \epsilon \rangle ,\langle \epsilon \rangle ,\langle \epsilon \rangle ),\langle b\rangle ),\langle b\rangle ),\langle a\rangle )}
conc(a,conc(b,conc(b,ϵ,b),b),a){\displaystyle conc(\langle a\rangle ,conc(\langle b\rangle ,conc(\langle b\rangle ,\langle \epsilon \rangle ,\langle b\rangle ),\langle b\rangle ),\langle a\rangle )}
conc(a,conc(b,bb,b),a){\displaystyle conc(\langle a\rangle ,conc(\langle b\rangle ,\langle bb\rangle ,\langle b\rangle ),\langle a\rangle )}
conc(a,bbbb,a){\displaystyle conc(\langle a\rangle ,\langle bbbb\rangle ,\langle a\rangle )}
abbbba{\displaystyle \langle abbbba\rangle }

Linear Context-free Rewriting Systems (LCFRSs)

[edit]

Weir (1988)[1] describes two properties of composition functions, linearity and regularity. A function defined asf(x1,...,xn)=...{\displaystyle f(x_{1},...,x_{n})=...} is linear if and only if each variable appears at most once on either side of the=, makingf(x)=g(x,y){\displaystyle f(x)=g(x,y)} linear but notf(x)=g(x,x){\displaystyle f(x)=g(x,x)}. A function defined asf(x1,...,xn)=...{\displaystyle f(x_{1},...,x_{n})=...} is regular if the left hand side and right hand side have exactly the same variables, makingf(x,y)=g(y,x){\displaystyle f(x,y)=g(y,x)} regular but notf(x)=g(x,y){\displaystyle f(x)=g(x,y)} orf(x,y)=g(x){\displaystyle f(x,y)=g(x)}.

A grammar in which all composition functions are both linear and regular is called a Linear Context-free Rewriting System (LCFRS). LCFRS is aproper subclass of the GCFGs, i.e. it has strictly less computational power than the GCFGs as a whole.

On the other hand, LCFRSs are strictly more expressive thanlinear-indexed grammars and theirweakly equivalent varianttree adjoining grammars (TAGs).[2]Head grammar is another example of an LCFRS that is strictly less powerful than the class of LCFRSs as a whole.

LCFRS are weakly equivalent to (set-local)multicomponent TAGs (MCTAGs) and also withmultiple context-free grammar (MCFGs[1]).[3] andminimalist grammars (MGs). The languages generated by LCFRS (and their weakly equivalents) can be parsed inpolynomial time.[4]

See also

[edit]

References

[edit]
  1. ^abWeir, David Jeremy (Sep 1988).Characterizing mildly context-sensitive grammar formalisms(PDF) (Ph.D.). Paper. Vol. AAI8908403. University of Pennsylvania Ann Arbor.
  2. ^Laura Kallmeyer (2010).Parsing Beyond Context-Free Grammars. Springer Science & Business Media. p. 33.ISBN 978-3-642-14846-0.
  3. ^Laura Kallmeyer (2010).Parsing Beyond Context-Free Grammars. Springer Science & Business Media. p. 35-36.ISBN 978-3-642-14846-0.
  4. ^Johan F.A.K. van Benthem;Alice ter Meulen (2010).Handbook of Logic and Language (2nd ed.). Elsevier. p. 404.ISBN 978-0-444-53727-0.
Each category of languages, except those marked by a*, is aproper subset of the category directly above it.Any language in each category is generated by a grammar and by an automaton in the category in the same line.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Generalized_context-free_grammar&oldid=1064807261#Linear_Context-free_Rewriting_Systems_(LCFRSs)"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp