assaad
asked on
Prolog translation program
Hi i am trying to create a small dicionary, i did the following, but this won't check between the--> la and the--> les
and the-->le. my program will only put the first one.
so can anybody give me a solution to let this program answer more questions?
dict(the,le).
dict(the,la).
dict(the,les).
dict(dog,chien).
dict(dogs,chiens).
dict(chases,chasse).
dict(chase,chassent).
dict(cat,chat).
dict(cats,chats).
translate([Word|Words],[Mo t|Mots]) :- dict(Word,Mot), !, translate(Words,Mots).
translate([],[]).
?- translate([the,cat,chases, the,dog], French).
French = [le, chat, chasse, le, chien] ;
No
and the-->le. my program will only put the first one.
so can anybody give me a solution to let this program answer more questions?
dict(the,le).
dict(the,la).
dict(the,les).
dict(dog,chien).
dict(dogs,chiens).
dict(chases,chasse).
dict(chase,chassent).
dict(cat,chat).
dict(cats,chats).
translate([Word|Words],[Mo
translate([],[]).
?- translate([the,cat,chases,
French = [le, chat, chasse, le, chien] ;
No
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Then what exactly should be the code for this?
If you have a solution for what i have it would be better
If you have a solution for what i have it would be better
Are you trying to do a word for word translation - be careful - real languages do not work that way.
A dictionary is possible in the sense that a word can be related to a root in another language but gender may not always map across and articles are not the same in other languages. They have different tenses and the phraseology may simply not translate.
In general:
>> translate([the,cat,chases, the,dog], French).
>> French = [le, chat, chasse, le, chien] ;
Is not possible - in Prolog or any other 'logical' language simply because natural languages are not logical!
A dictionary is possible in the sense that a word can be related to a root in another language but gender may not always map across and articles are not the same in other languages. They have different tenses and the phraseology may simply not translate.
In general:
>> translate([the,cat,chases,
>> French = [le, chat, chasse, le, chien] ;
Is not possible - in Prolog or any other 'logical' language simply because natural languages are not logical!
ASKER
but i did it
and it works in the code i wrote, but what i need now is to have a better code that will let prolog answer more questions.
like: translate([the,cats,chase, the,dogs], French).
and the answer should come like that: French = [les, chats,chassent,les,chiens] .
and it works in the code i wrote, but what i need now is to have a better code that will let prolog answer more questions.
like: translate([the,cats,chase,
and the answer should come like that: French = [les, chats,chassent,les,chiens]
In that example you did.
What I was adding was only that - in general - not all english sentences can be translated to a french sentence in this way. The same goes for any language->language mapping.
Sometimes
translate( [1,2,3,4] ) = [9]
or
translate( [1,2,3] ) = [5,6,7,8,9]
For a stupid example: "C'est la vie" translates as "Such is life", or "That's the way things are" but would translate literally as "It is the life".
So a symbol to symbol mapping will not work.
Now a simple dictionary lookup is probably going to be ok ... but a language translator is not.
But good luck with your project anyway!
What I was adding was only that - in general - not all english sentences can be translated to a french sentence in this way. The same goes for any language->language mapping.
Sometimes
translate( [1,2,3,4] ) = [9]
or
translate( [1,2,3] ) = [5,6,7,8,9]
For a stupid example: "C'est la vie" translates as "Such is life", or "That's the way things are" but would translate literally as "It is the life".
So a symbol to symbol mapping will not work.
Now a simple dictionary lookup is probably going to be ok ... but a language translator is not.
But good luck with your project anyway!
ASKER
the only thing i want is word to word translater that's all, but with one more addition:
i have to check if the sentence will need a "la" or "les" or "le" because these words in french are the same word in english
---> "the"
got it?
that's all i need.
i have to check if the sentence will need a "la" or "les" or "le" because these words in french are the same word in english
---> "the"
got it?
that's all i need.
Then I'd have the articles go with the nouns and add "the cat"... to the dictionary.
?- translate([the cat,chases,the dog], French).
?- translate([the cat,chases,the dog], French).
ASKER
:) this does not work
ASKER
The thing is that nobosy gave me a solution yet, all what they provide is very basic, and has nothing to do with the solution.
Thanks.
Thanks.
Comment:
I think the problem was that the questioner was not clear about the question.
On the surface the solution has to do with basic prolog list manipulation - but seems to also be about natural language translation - so I gave guidance on that point.
If it is to do with basic prolog list manipulation then it probably forms part of a homework assignment and the solution would be found with a bit of experimentation and reading.
I'm happy for 'assaad' to have his points refunded.
I think the problem was that the questioner was not clear about the question.
On the surface the solution has to do with basic prolog list manipulation - but seems to also be about natural language translation - so I gave guidance on that point.
If it is to do with basic prolog list manipulation then it probably forms part of a homework assignment and the solution would be found with a bit of experimentation and reading.
I'm happy for 'assaad' to have his points refunded.
ASKER
well first this is not a homework, second the question was very clear from the begining.
and no answer, all the answers don't give anything related to the solution.
and no answer, all the answers don't give anything related to the solution.
dict(dog,chien).
dict(dogs,chiens).
dict(the dog,le chien).
dict(the dogs,les chiens).
dict(chases,chasse).
dict(chase,chassent).
dict(cat,chat).
dict(cats,chats).
dict(the cat,le chat).
dict(the cats,les chats).