Tradutor em Life
description
Transcript of Tradutor em Life
Tradutor em Life
Leonardo Lemos
Paulo Borges
Reginaldo Valadares
Interpretador
interp(phraseUk => PhraseUk,
interpUk=>constUk(syntrUk => SyntrUk, semr => Semr)) :-
toDown(PhraseUk, PhraseUkm),
tokenizer(PhraseUkm, WordlistUk),
constUk(syntrUk => SyntrUk,
semr => Semr,
in_dcg => WordlistUk,
out_dcg => []).
Discrepâncias sintáticasInglês - Português
• Ordem dos modificadores– “smelly wumpus” = wumpus fedorento
• Interrogativo/Auxiliares– “Do you smell a stench?” = “Você sente um
fedor?”
• Imperativo– “Shoot the wumpus!” = “Atire no wumpus!”
– “He shoots the wumpus” = “Ele atira no wumpus”
Discrepâncias de lexicalização Inglês - Português
• Conjugação dos Verbos– Inglês (Presente)
• smell, smells
– Português (Presente)• cheiro, cheiras, cheira, cheiramos, cheirais, cheiram
• Alinhamento– Verbo + Prep. => Verbo (“Go up” = “Suba”)
Discrepâncias de lexicalização Inglês - Português
• Ambiguidade– Ser, estar, ficar
• “The gold is (ser) mine” (Posse)
• “The wumpus is (estar) at 1 2” (Localidade)
– a, algum• “Do you smell a (algum) stench?” (Interrogativo)
• “I smell a (um) stench.” (Afirmativo)
Arquitetura do Tradutor
translate (X, Z) :- interp(phraseUk => X, interpUk => _I),
transfer(interpUk => _I, interpPt => _P),
gener(interpPt => _P, phrasePt => Z).
Regras de transferência sintáticastransfer(interpUk => constUk(syntrUk => syntr(syntcat => vg,
present => yes,
conjug => ConjugUk,
agreeFt => AgreeFtUk,
head => HeadUk)),
interpPt => constPt(syntrPt => syntr(syntcat => vg,
present => yes,
conjug => ConjugUk,
agreeFt => AgreeFtUk,
head => HeadPt))) :-
transfer(interpUk => HeadUk, interpPt => HeadPt).
Regras de transferência lexicais (léxico bilíngüe)
transfer(interpUk => constUk(syntrUk => syntr(syntcat => adv,
present => yes,
lex => X)),
interpPt => constPt(syntrPt => syntr(syntcat => adv,
present => yes,
lex => changeAdv(X)))).
changeAdv("left") -> "esquerda".
changeAdv("right") -> "direita".
Regras de transferêncialexico-sintática
• Ver Arquivo Life
Usar gramáticas de cláusulas definidas para geração
• Gramática Inglês– interp(“the wumpus is dead”,X)?
• X é um psi-term
• Transformação de Inglês para Português utilizando DCG– transf(X,Y)?
• Gramática Português– gener(Y,Z)?
Usar gramáticas de cláusulas definidas para geração
• Exemplo Life> constUk(syntrUk => X, in_dcg => ["the"], out_dcg => [])?
*** Yes
X = syntr(lex => "the", num => sing, present => yes, ref => def,
syntcat => article).
--1> constUk(syntrUk => X, in_dcg => Y, out_dcg => [])?
*** Yes
X = syntr(lex => "the", num => sing, present => yes, ref => def,
syntcat => article),
Y = ["the"].
Regras estruturais/concordância da sintaxe do português
• Determinantes– Inglês (Não depende do gênero do substantivo)
• the car, the house
– Português (Depende do gênero do substantivo)• o carro, a casa
Regras de escolha das palavras de classe fechada do português
constPt (syntrPt=>syntr(syntcat=>article,
present=>yes,
mood=>{declar;imper},
gen=>masc,
ref=>indef,
num=>sing)) --> ["um"]?
constPt (syntrPt=>syntr(syntcat=>article,
present=>yes,
mood=>inter,
gen=>masc,
ref=>indef,
num=>sing)) --> ["algum"]?
Regras morfológica do português
• Plural (Verbo)– Inglês
• Só altera a terceira pessoa do singular
– Português• Todas as pessoas podem variar
Demo ao vivo