traductor spanish to english

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
javipalma
Forum Newbie
Posts: 2
Joined: Fri Jul 25, 2008 2:31 pm

traductor spanish to english

Post by javipalma »

Friends.
Im making a traductor spanish to english.

I have a DB with this words (example)

KEYSPN (SPANISH KEYWORD) - KEY_ENG (ENGLISH TRADUCTION)
chicos child
mujer woman
aires air
buenos good
buenos aires buenos aires


i have this query in a search box = "chicos buenos of buenos aires"

To do the traduction of this string i do a query split by " " (blank space) and i get an array like this

[] = "chicos"
[] = "buenos"
[] = "de"
[] = "buenos"
[] = "aires"

The problem is that i need my script recognize "whole words",
For example
if i make a word by word traduction i get = "child good of good air".
but i need:
"child good of buenos aires"

I need that my script recognize "BUENOS AIRES" like a "whole word" not like 2 split strings
Have idea??
Thanks!!!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: traductor spanish to english

Post by Christopher »

Translation is more complicated than that. You should do some research on translation parsers. Or use web services and something like Google.
(#10850)
javipalma
Forum Newbie
Posts: 2
Joined: Fri Jul 25, 2008 2:31 pm

Re: traductor spanish to english

Post by javipalma »

Dear Christopher
I dont want enter in the words traslation subject, i know it is complicated.
If i could know how make a traslation of a whole word like "buenos aires" and get "buenos aires" and NOT "good air", this will be very helpfull.
For example a idea is:

query="chicos buenos de buenos aires"

i check every secuence of string..

chicos buenos de buenos aires (no match)
chicos buenos buenos de buenos (no match)
chicos buenos de (no match)
chicos buenos (no match)
chicos buenos (no match)
chicos (match)
//I continue with the following
buenos de buenos aires (no match)
buenos buenos de (no match)
buenos buenos (no match)
buenos (match)
//I continue with the following
de buenos aires (no match)
de buenos (no match)
de (match)
//I continue with the following
buenos aires (match)
Finish

this be a solution but I think it would take much if there are several words in the query.
Your you think?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: traductor spanish to english

Post by Christopher »

It seems like it would be better to store whether each word started a sequence. So "buenos" would have an entry that if followed by "aires" then don't translate. But you will still need context because "buena vista", for example, could be a city or just mean "good view".
(#10850)
Post Reply