Jump to content


Photo

translator for non-official languages?


  • Please log in to reply
4 replies to this topic

#1 the potato whisperer

the potato whisperer

    GMC Member

  • GMC Member
  • 40 posts
  • Version:GM8.1

Posted 09 May 2012 - 07:20 PM

is there any way to make a game (not really a game) where you can type in text and click a button for a custom created-language translation?
(GMlite only)
if possible, help would be appreciated.

0j0
-

Edited by the potato whisperer, 09 May 2012 - 07:21 PM.

  • 0

#2 Jack Indie Box

Jack Indie Box

    GMC Member

  • GMC Member
  • 1558 posts
  • Version:GM:Studio

Posted 09 May 2012 - 07:42 PM

by custom language to you mena a fantasy(made up one)

else if you mean say spanish, i would not bother as translation is a very advance thing that even google doesnt do perfectly and applications that translations require big databases and alot of work and knowledge on both languages. If you really want traditional translation for 2 well known languages there may be an API available for other programs(not game maker) that could allow it.

why do you want it?
  • 0

#3 PetzI

PetzI

    GMC Member

  • GMC Member
  • 1059 posts
  • Version:GM:Studio

Posted 09 May 2012 - 07:45 PM

It's possible to make, but good automatic translators are very complex. Even professional automatic translators I don't think have ever reached the sort of quality you would expect from a very bad human translator. That is of, course, for real languages. It depends on what your language is like in terms of similarity to other languages.
  • 0

#4 Follomania

Follomania

    Unum Mirabile

  • GMC Member
  • 445 posts
  • Version:GM:Studio

Posted 09 May 2012 - 07:54 PM

The simplest (but most time consuming) method would be to use string_replace_all().
for example:
first = string_lower('Hey!  What are you doing today?')
string_replace_all(first, 'hey', 'pasfe')
string_replace_all(first, 'what', 'sgsg')
string_replace_all(first, 'are', 'sgea')
//...

And then have a string_replace_all() dedicated to every single word.
You could also have two database files with each word corresponding to the word in the other file at the same position. Then you could just have a loop replacing the strings.

file_1 = file_text_open_read('English.txt')
file_2 = file_text_open_read('Other.txt')
while (file_text_eof(file_1) == 0){
    string_replace_all(string, file_text_read_string(file_1), file_text_read_string(file_2))
    file_text_readln(file_1)
    file_text_readln(file_2)
}
file_text_close(file_1)
file_text_close(file_2)

Whatever method you use, this is going to have quite a bugger of a time translating.
  • 0

#5 dannyjenn

dannyjenn

    GMC Member

  • GMC Member
  • 2736 posts
  • Version:Mac

Posted 09 May 2012 - 07:57 PM

It's highly possible... even easy for a language extremely similar to English, such as Pig Latin.
For a made-up language with different grammer (e.g. one that follows Spanish word order as opposed to English word order) can get a little more difficult, and one with entirely different grammar (e.g. one that follows Japanese word order as opposed to English word order) can get very difficult.
Once you handle rearranging the sentence structure and re-conjugating verbs, nouns, adjectives, etc. then it's pretty much completely vocab swap. Which is time consuming, as you'll need to make lists of thousands of words (unless it's something real simple like Pig Latin, where you just have to rearrange the string rather than swap entire words).
The difficult part is when there are 2 English words which mean something entirely different but are spelled exactly the same... you'll need to somehow program it to tell the two apart.
And preserving capitalization can get difficult, if the case matters.

Here's an example of swapping word order to go from English to Spanish (except this is written in JavaScript so it's not valid GML):
function repositionAdjective(){
    list = text.substring(0,text.length).split(" ");
    text = "";
    for(a=0;a<list.length;a+=1){
        if(partOfSpeech(list[a])=="adjective"){
            if(partOfSpeech(list[a+1])=="noun"){
                text+=list[a+1]+" "+list[a]+" ";
                a+=1;
            }
            else if(partOfSpeech(list[a+1])!="noun"){
                text+=list[a]+" ";
            }
        }
        else if(partOfSpeech(list[a-1])=="adjective" && (partOfSpeech(list[a-2])=="noun") && a>1){
            text+=list[a]+" ";
        }
        else{
            text+=list[a]+" ";
        }
    }
}
And for that you'll need a function that returns the part of speech of a word. Which gets complicated for words with multiple parts of speech, such as "jump" (noun), "jump" (verb), or other (the "jump" in "jump drive").
And that won't even work on Spanish, since Spanish has genders. And it doesn't work for phrases with multiple adjectives, such as "big brown house".

Edited by dannyjenn, 09 May 2012 - 08:09 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users