GF Tutorial
46 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
46 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

GF Tutorial 2S yntax an d T ranslation s ystems in GFM uhammad H umayounmhuma [at] univ-sav oie.frPhD student, Department of Mathematic s (LAMA)Universite de s avoie Ba sed on the course named "N atural Lan guage Technology", talks and tutorials given by Aarne Ranta (aa rne [at] cs.chalmers.se) 1P lan• Cont ext-f ree g rammars• Som e us eful com mands• The gf grammar fo r sy ntax• Translation Systems (Case Stud y)• Grammar architecture• M ore Cons tructs in G F• Depe ndant typ es• Discontinuous c onstituents• Som e issue s i n tran slation2From words to phrases• A sentence consists of phrases, which in turn consist of phrases, and in the end of one-word phrases.• S ome classical classes– S entence: my li ttle brot her has ne ver ea ten pizza– N oun phras e: my li ttle brot her– Verb phra se: has n ever eate n pi zza– Common noun: hom e-ma de pizza– Transiti ve ver b: has eat en– Adjectival phras e: very very tas ty– Adverbial ph rase: nev er i n his life 3Ubiquitous BN F notation (Backus N aur Form)Context-free grammar (.cf)The Food exampleS ::= I tem "i s" Quality ;Item ::= "this" Kind | " that" Kind ;Kind ::= Q uality Ki nd ;Kind ::= "wine" | "cheese" | "fish" ;Q uality :: = "very" Quality ;Q uality :: = "fresh" | "warm" | "Fr ench" | "expensive" | "del icious" | "boring" ;4S ome Co mmandsP arsing sentences> p "this cheese is delicious"S _Item_is_Q uality (Item_this_Kind Kind_cheese) Q ...

Informations

Publié par
Nombre de lectures 24
Langue English

Extrait

p "this cheese is delicious"S _Item_is_Q uality (Item_this_Kind Kind_cheese) Q ..." />

GF Tutorial 2
S yntax an d T ranslation s ystems in GF
M uhammad H umayoun
mhuma [at] univ-sav oie.fr
PhD student, Department of Mathematic s (LAMA)
Universite de s avoie
Ba sed on the course named "N atural Lan guage Technology", talks and tutorials given by
Aarne Ranta (aa rne [at] cs.chalmers.se) 1P lan
• Cont ext-f ree g rammars
• Som e us eful com mands
• The gf grammar fo r sy ntax
• Translation Systems (Case Stud y)
• Grammar architecture
• M ore Cons tructs in G F
• Depe ndant typ es
• Discontinuous c onstituents
• Som e issue s i n tran slation
2From words to phrases
• A sentence consists of phrases, which in turn
consist of phrases, and in the end of one-word
phrases.
• S ome classical classes
– S entence: my li ttle brot her has ne ver ea ten pizza
– N oun phras e: my li ttle brot her
– Verb phra se: has n ever eate n pi zza
– Common noun: hom e-ma de pizza
– Transiti ve ver b: has eat en
– Adjectival phras e: very very tas ty
– Adverbial ph rase: nev er i n his life
3Ubiquitous BN F notation
(Backus N aur Form)
Context-free grammar (.cf)
The Food example
S ::= I tem "i s" Quality ;
Item ::= "this" Kind | " that" Kind ;
Kind ::= Q uality Ki nd ;
Kind ::= "wine" | "cheese" | "fish" ;
Q uality :: = "very" Quality ;
Q uality :: = "fresh" | "warm" | "Fr ench" | "expensive" |
"del icious" | "boring" ;
4S ome Co mmands
P arsing sentences
> p "this cheese is delicious"
S _Item_is_Q uality (Item_this_Kind Kind_cheese) Q uality_delicious
> p "that wine is very very French"
S _Item_is_Q uality (Item_that_Kind Kind_wine) (Q uality_very_Q uality
(Q uality_very_Q uality Q uality_French))
> p "hello world"
N o success in cf parsing hello world, no tree found
5S ome Commands
Generating trees and strings
L inearization (linearize = l)
>l S _Item_is_Q uality (Item_that_Kind Kind_wine) Q uality_warm
that wine is warm
Random generation (generate_random = gr)
> generate_random
S _Item_is_Q uality (Item_this_Kind Kind_wine) Q uality_delicious
Using a pipe
> gr | l
this fresh cheese is delicious
6S ome Commands
Visualizing trees (visualize_tree = vt)
> p "this delicious cheese is very French" | vt
To generate all sentence systematically (generate_trees= gt):
> gt | l
W e can get quite a few trees but not all of them: only up to a given depth of
trees. 7S ome Commands
S ystematic generation (generate_trees= gt)
> gt -depth= 3 | l
To generate trees up to a given depth of trees
Tracing, The intermediate results in a pipe can be observed by
putting the tracing flag -tr to each command:
> gr -tr | l -tr | p
S _Item_is_Q uality (Item_this_Kind Kind_cheese) Q uality_boring
this cheese is boring
S _Item_is_Q uality (Item_this_Kind Kind_cheese) Q uality_boring
8S ome Commands
W riting and reading files
Writi ng o utput in a file
> gr -num ber=10 | l | wf ex x.t mp
Reading a file
> rf exx .tm p | p -li nes
9The labelled context-free format
PredVP. S ::= NP VP man. N ::= "man"
pizza. N ::= "pizza" DetCN . NP ::= Det CN
bar. N ::= "bar" Lex V. VP ::= V
bottle. N ::= "bottle"
UseAP. VP ::= "is" AP tram. N ::= "tram"
Lex N . CN ::= N
big. A ::= "big" Mo dC N. CN ::= AP CN
expensive. A::= "expensive" Lex A. AP ::= A
french. A ::= "Fre nch"
veryAP. AP ::= "very" AP sleep. V ::= "sleeps"
run. V ::= "runs"
the. Det ::= "the"
every. D et ::= "every"
this. Det ::= "this"
10

  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents