Taaltheorie & Taalverwerking

Download Report

Transcript Taaltheorie & Taalverwerking

Taaltheorie & Taalverwerking
Week 12: Automatisch Vertalen
Jurafsky & Martin (ed. 1), Hoofdstuk 21:
Machine Translation
Automatisch Vertalen
(Machine Translation)
Vol-automatische vertaling van een tekst van
de ene taal naar de andere.
Automatisch Vertalen
• Het probleem: verschillen tussen talen
• Vier benaderingen van MT
–
–
–
–
Direct
Transfer
Interlingua
Statistisch
• Toepassingen
Machine Translation:
Vol-automatische vertaling van een tekst van
de ene taal naar de andere.
Waarom is dat moeilijk?
Voorbeeld Jurafsky & Martin:
Vertaling van 18e-eeuwse Chinese literatuur naar
hedendaags Engels.
Voorbeeld: Chinees-Engels
Dai-yu alone on bed top think-with-gratitude-about Baochai again
listen to window outside bamboo tip plantain leaf of on-top
rain sound sigh drop
clear cold penetrate curtain
not feeling again fall down tears come
Voorbeeld: Chinees-Engels
Dai-yu alone on bed top think-with-gratitude-about Baochai again
listen to window outside bamboo tip plantain leaf of on-top
rain sound sigh drop
clear cold penetrate curtain
not feeling again fall down tears come
As she lay there alone, Dai-yu’s thoughts turned to Baochai…
Then she listened to the insistent rustle of the rain on the
bamboos and plantains outside her window.
The coldness penetrated the curtains of her bed.
Almost without noticing it she had begun to cry.
Iets letterlijkere vertaling
Dai-yu alone on bed top think-with-gratitude-about Baochai again
listen to window outside bamboo tip plantain leaf of on-top
rain sound sigh drop
clear cold penetrate curtain
not feeling again fall down tears come
Alone on her bed, Dai-yu thought again with gratitude
about Bao-chai.
She listened to the rustle of the rain on the tips of the
bamboos and the leaves of the plantains outside her
window.
The clear cold penetrated the curtains.
Without noticing it, she started to cry again.
Probleem: lidwoorden
Dai-yu alone on bed top think-with-gratitude-about Baochai again
listen to window outside bamboo tip plantain leaf of on-top
rain sound sigh drop
clear cold penetrate curtain
not feeling again fall down tears come
Alone on her/the bed, Dai-yu thought again with
gratitude about Bao-chai.
She listened to the rustle of (the) rain on (the) tips of
(the) bamboos and (the) leaves of (the) plantains
outside her/the window.
The clear cold penetrated the curtains.
Without noticing it, she started to cry again.
Probleem: "zero anaphora"
Dai-yu alone on bed top think-with-gratitude-about Baochai again
listen to window outside bamboo tip plantain leaf of on-top
rain sound sigh drop
clear cold penetrate curtain
not feeling again fall down tears come
Alone on her bed, Dai-yu thought again with gratitude
about Bao-chai.
She listened to the rustle of the rain on the tips of the
bamboos and the leaves of the plantains outside her
window.
The clear cold penetrated the curtains.
Without noticing (it), she started to cry again.
Probleem: werkwoordstijden
Dai-yu alone on bed top think-with-gratitude-about Baochai again
listen to window outside bamboo tip plantain leaf of on-top
rain sound sigh drop
clear cold penetrate curtain
not feeling again fall down tears come
Alone on her bed, Dai-yu thought again with gratitude
about Bao-chai.
She listened to the rustle of the rain on the tips of the
bamboos and the leaves of the plantains outside her
window.
The clear cold penetrated the curtains.
Without noticing it, she started to cry again.
Probleem: lexicon
Dai-yu alone on bed top think-with-gratitude-about
Bao-chai again
listen to window outside bamboo tip plantain leaf of on-top
rain sound sigh drop
clear cold penetrate curtain
not feeling again fall down tears come
Alone on her bed, Dai-yu thought again with gratitude
about Bao-chai.
She listened to the rustle of the rain on the tips of the
bamboos and the leaves of the plantains outside her
window.
A cold draught penetrated the curtains of her bed.
Without noticing it, she started to cry again.
Probleem: woordvolgorde
Dai-yu alone on bed top think-with-gratitude-about Baochai again
listen to window outside bamboo tip plantain leaf of
on-top rain sound sigh drop
clear cold penetrate curtain
not feeling again fall down tears come
Alone on her bed, Dai-yu thought again with gratitude
about Bao-chai.
She listened to the rustle of the rain on the tips of the
bamboos and the leaves of the plantains outside her
window.
A cold draught penetrated the curtains of her bed.
Without noticing it, she started to cry again.
Verschillen tussen talen
Verschillen tussen talen
Theoretische taalwetenschap:
taal-typologie: taxonomie van de verschillen
en overeenkomsten tussen de verschillende
talen
Morphologie vs. Syntax
• Isolerende talen
– Chinees, Vietnamees: 1 word – 1 morpheem
• Polysynthetische talen
– Eskimo-talen, Koreaans: 1 woord veel morphemen
• Ertussenin (Engels, Nederlands)
Morphologie vs. Syntax
Rijkere morphologie correleert met vrijere
woordvolgorde.
B.v.: klassiek Latijn: “casus-markering”:
de rol van een NP in de zin wordt aangegeven door de
verbuiging van de Noun (“Rosa, Rosae, Rosam...”); de
plaats van de NP in de zin is vrij.
Syntax: verschillende “basis-volgordes”
• SVO (Subject-Verb-Object) talen
– Engels, Mandarijns
• SOV talen
– Japans, Hindi, Nederlands
• VSO talen
– Iers, Klassiek Arabisch
Syntax
• SVO-talen:
preposities:
Engels: "to Yuriko"
• "echte" SOV-talen:
postposities: Japans: "Yuriko ni"
Segmentatie
• Woordgrenzen worden niet in alle talen
gemarkeerd!
– Chinees, Japans, Thai, Vietnamees
Syntax vs. Discourse
• Zeer lange zinnen (te vertalen als alinea's)
– Modern Standaard Arabisch, Chinees
• Zeer korte zinnen (te combineren tot
complexe zinnen)
– Papoea-talen, Aboriginal-talen
Lexical Divergence
Lexical Divergence: Gaps
• Japanese: no word for "privacy"
• English: no word for Cantonese ‘haauseun’
or Japanese ‘oyakoko’ (something like
`filial piety’)
Vertaalprogramma's
Vertaalprogramma's:
Methodes
3 methoden voor MT
• Direct
• Transfer
• Interlingua
3 methoden voor MT
Interlingua
expression
Semantic Analysis
Syntactic
Structure
Syntactic Analysis
Morpheme
Sequence
Morphological
Analysis
Source Text
(Syntactic)
Transfer
Direct
Syntactic
Structure
Morpheme
Sequence
Morphological
Generation
Target Text
Direct Translation
• Morfologische analyse van brontaal-zin
 morfeem-sequentie.
• Transformaties op deze morfeem-sequentie
 doeltaal-zin.
Direct MT: Japans  Engels
Wa ta shi ha tsu kue no ue no pen wo jon ni a ge ta
1. Morfologische analyse
Wa ta shi ha tsu kue no ue no pen wo jon ni a ge ta
Watashi ha tsukue no ue no pen wo jon ni ageru PAST
2) Woordenboek: vertaling van inhoudswoorden
Watashi ha tsukue no ue no pen wo jon ni ageru PAST
I ha desk no ue no pen wo John ni give PAST
3) PP-transformaties
I ha desk no ue no pen wo John ni give PAST
I ha
pen on desk wo to John give PAST
Direct MT: Japans  Engels
4) Werkwoordsverplaatsing
I ha pen on desk wo to John give PAST.
I give PAST pen on desk to John.
5) Lidwoord-insertie
I give PAST pen on desk to John.
I give PAST the pen on the desk to John.
6) morphological generation
I give PAST the pen on the desk to John.
I gave
the pen on the desk to John.
Direct MT: pros & cons
• Pros
– Computationeel overzichtelijk
– Snel
• Cons
– Conceptueel onoverzichtelijk
– Linguïstisch onbetrouwbaar
Het Transfer Model
B.v.: Engels  Frans
– Engels: Adjective Noun
– Frans: Noun Adjective
N.B. Er zijn uitzonderingen: B.v.:
• "route mauvaise": ‘slechte weg’
• "mauvaise route": ‘verkeerde weg’
– Engels: Adjective Noun
– Frans: Noun Adjective
Regel:
noun phrase  adjective noun

noun phrase  noun adjective
existential-there-sentence
there
BE
NP
Transfer voorbeeld: Engels  Japans
VP-ing
There is [a black swan] [swimming in the pond].
S
NP
[[A black swan] [swimming in the pond] is.
NP
VP-ing
BE
Existential-There-Sentence  There1 BE2 NP3 VP-ing4

S  (NP  NP3 VP-ing4 ) BE2
Regel voor Existential-there: deleer constituent 1 en
maak van constituent 4 een rechter-modifier van
constituent 3; verplaats constituent 2 naar het eind.
Transfer voorbeeld: Engels  Japans
NP
NP
VP-ing
[a black swan] [swimming in the pond].
NP
VP-ing
NP
[swimming in the pond] [a black swan].
NP  NP1 VP-ing2

NP  VP-ing2 NP1
Regel voor Relative Clause:
Keer constituentenvolgorde om.
existential-there-sentence
there was (an old man) gardening
Regel voor Existential-there
Intermediate Representation
An old man gardening was
Regel voor relative clauses
Intermediate Representation-2
garde ning an old man was
Lexicon
Japanese-S
Niwa no teire o suru ojisan ita
Transfer voorbeeld: Engels  Japans
English to Japanese Transfer
Niwa no teire o suru ojiisan ita
• Insereer “ga” na het onderwerp
• Congruentie tussen werkwoord en onderwerp
• Werkwoordsvervoeging
Niwa no teire o shite ita
Gardening
Garden GEN upkeep OBJ do PASTPROG
ojiisan ga ita
old man
SUBJ was
Transfer: enkele beperkingen
• Specifieke regels voor elk taal-paar
• Houdt geen rekening met semantiek
• Houdt geen rekening met statistiek
MT Methode 3: Interlingua
1) Vertaal brontaal-zin naar betekenisrepresentatie
2) Genereer doeltaal-zin op grond van betekenisrepresentatie.
Interlingua voor
"There was an old man gardening"
EVENT:
GARDENING
AGENT:
[MAN
NUMBER:
SG
DEFINITENESS:
INDEF]
ASPECT:
PROGRESSIVE
TENSE:
PAST
Interlingua MT: pros & cons
• Pros
– Één stelsel regels voor elke taal (i.p.v. voor elk
paar talen).
• Cons:
– Semantiek is moeilijk
– Syntactische informatie gaat verloren!
"Alternatief":
De Statistische benadering
What makes a good translation
Translators often talk about two factors we want to
maximize:
• Faithfulness or fidelity
– How close is the meaning of the translation to the
meaning of the original
• Fluency or naturalness
– How natural the translation is, just considering its
fluency in the target language
05/08/06
Statistical MT:
Formalizing Faithfulness and Fluency
05/08/06
Naar analogie van spraakherkenning:
Regel van Bayes:
Kans op target-zin T gegeven source-zin S:
P(T|S) = P(S|T) * P(T)
05/08/06
Afleiding van de regel van Bayes:
P(S & T) = P(S|T) * P(T)
en
P(S & T) = P(T|S) * P(S)
Dus:
P(T|S) * P(S) = P(S|T) * P(T)
Als S gegeven is:
P(T|S) = P(S|T) * P(T)
05/08/06
Kans op target-zin T gegeven source-zin S:
P(T|S) = P(S|T) * P(T)
P(T|S) = Faithfulness(S,T) * Fluency(T)
05/08/06
Fluency: P(T)
How to measure that the sentence
"That car was almost crash onto me"
is less fluent than:
"That car almost hit me."
Answer: probabilistic language models
For example: n-grams:
P(hit|almost) > P(crash|almost)
05/08/06
Faithfulness: P(S|T)
• French: "ça me plait" ["that me pleases"]
• English:
• "that pleases me"
• "I like it"
• "I’ll take that one"
How to quantify this?
Intuition: degree to which words in one sentence are
plausible translations of words in other sentence
The probability that the target sentence words translate
into the source sentence words.
05/08/06
Faithfulness P(S|T)
• Need to know, for every target language word,
probability of it mapping to every source language
word.
• How do we learn these probabilities?
• Parallel texts!
– Given that we have two texts that are translations of
each other
– If we knew which word in Source Text mapped to each
word in Target Text, we could just count!
05/08/06
Faithfulness P(S|T)
Voorbewerken van parallelle teksten
• Sentence alignment:
– Figuring out which source language sentence
maps to which target language sentence
• Word alignment
– Figuring out which source language word maps
to which target language word
05/08/06
Samenvatting van de statistische
benadering:
• Het "faithfulness model" P(S|T) maakt een woord
voor woord vertaling en maakt zich geen zorgen
over woordvolgorde
• Het "language model" van de doeltaal P(T) kiest
de juiste woordvolgorde.
Voorbeeld: zet de volgende woorden in de juiste volgorde:
"have programming a seen never I language better"
05/08/06
Maar:
"loves Mary John"
05/08/06
?
Example
Japanese phrase: "2000nen taio"
2000nen
2000
Y2K
2000 years
2000 year
Taio
Correspondence
Corresponding
Equivalent
Tackle
Dealing with
Deal with
05/08/06
Woord-voor-woord vertaling:
2000 Correspondence
P(S|T) * P(T) might produce:
Dealing with Y2K
Statistische MT
Samenvatting:
Statistische MT is een statistische versie van
een bijzonder eenvoudige vorm van "direct
translation".
05/08/06
Statistische MT
Samenvatting:
Statistische MT is een statistische versie van
"direct translation".
Onderzoeksvraag:
Synthese van statistische benadering met
structurele benadering
05/08/06
Statistische MT
Onderzoeksvraag:
Synthese van statistische benadering met
structurele benadering.
Gebruik geannoteerde corpora &
statistische grammatica's.
05/08/06
Automatisch vertalen:
Toepassingen
Fully Automatic High Quality Translation
voor open domein lukt nog niet.
Fully Automatic High Quality Translation
voor open domein lukt nog niet.
Wel:
• Beperkt domein
• Semi-automatisch
• Niet heel hoge kwaliteit
Beperkte domeinen: "subtalen"
Beperkte domeinen: "subtalen"
B.v.: Weerberichten.
“Bewolkt met kans op regen.
Aan de kust overwegend zonnig.”
TAUM-METEO (Canada, 1976): Volautomatische
weerberichtenvertaling van Engels naar Frans.
Specialistische grammatica met semantische
categorieën.
Semi-automatisch:
• Pre-editing
• Post-editing
• Interactief
• Vertaal-hulpmiddelen:
elektronische woordenboeken,
vertaal-geheugens
Niet heel hoge kwaliteit:
B.v.: bij internet-search.
Opdracht:
Transfer-vertaling
van Engels naar Nederlands
05/08/06
05/08/06
Vertaalprogramma's:
Geschiedenis
• Eerste ideeën: 1940's. (Directe woord-voorwoord-vertaling.)
• Eerste demo: IBM/Georgetown: Russisch-Engels,
1954.
• Inzichten over de beperkingen van zuiver
syntactische benaderingen:
Bar-Hillel (1959), ALPAC Report (1964)
Vettaalprogramma's:
Geschiedenis
•
•
•
•
•
1960's: Systran (BabelFish)
1976: TAUM-METEO (weerberichten)
1980’s: EUROTRA project (mislukt)
1984: Nagao: Example-Based MT
1990’s:
• WWW
• Speech-to-speech translation
• Statistical MT
Lexicale ambiguïteit.
B.v.: Engels-Nederlands:
pen  pen
 box, omheining
"The pen is in the basket"
"The basket is in the pen"


"De pen zit in het mandje"
"Het mandje staat in de box"
Lexicale ambiguïteit.
"The pen is [not] in the basket"  "De pen zit [niet] in het mandje"
"The basket is [not] in the pen"  "Het mandje staat [niet] in de box"
Mogelijke rol van A.I. (Ontologies, “World Models”) bij
Automatisch Vertalen:
Verwerp interpretaties die contradictoir (nooit waar) zijn,
en interpretaties die tautologisch (altijd waar) zijn.
Lexicale ambiguïteit.
"The pen is in the basket"
"The basket is in the pen"


"De pen zit in het mandje"
"Het mandje staat in de box"
Andere gevolgtrekking uit deze zelfde voorbeelden:
Automatisch vertalen is onmogelijk. Stop alle subsidies.
Yehoshua Bar-Hillel: “Report on the state of MT in US and GB”, 1959;
Automatic Language Processing Advisory Committee (US National Academy of
Science), 1964.
Hugo Brandt Corstius: "Wat je ook doet, de semantiek gooit roet."
Lexicale ambiguïteit is niet het enige probleem.
Morphologie
• Agglutinatieve talen
– Turks: elk morpheem markeert 1 ding
• Fusie-talen
– Russisch, Nederlands: 1 morpheem kan een aantal dingen tegelijk
markeren
B.v.: "Jan loopt":
t markeert: 2e/3e persoon; enkelvoud; tegenwoordige tijd
Discourse
• "Zero Anaphora" (Japanse, Chinees).
Lexicon
• Woorden vs. frases:
– English “computer science” =
Nederlands: "informatica"
• Verschillende woordsoorten:
– Engels ‘She likes to sing’
vs. Nederlands: "Ze zingt graag"
– Engels "I’m hungry"
vs. Nederlands: "Ik heb honger".
Lexicon: Specificiteit
• Grammatical constraints
– English has gender on pronouns, Mandarin not.
• So translating “3rd person” from Chinese to English, need to
figure out gender of the person!
• Similarly from English “they” to French “ils/elles”
• Semantic constraints
– English `brother’
vs.
Mandarin ‘gege’ (older) / ‘didi’ (younger)
– English ‘wall’ vs.
German ‘Wand’ (inside) / ‘Mauer’ (outside)
– German ‘Berg’ vs. English ‘hill’ /‘mountain’
– English ‘cow’ /‘beef’ vs. Cantonese ‘ngau’