Monday, February 6, 2012

How do you build a fictional language translator on the computer?

Hey! My friends and I came up with a roleplay idea, since we're into that and all. :P

We're got a ton of mythical creatures- humanoids (vampires, mermaids, fae), beasts (phoenixes, pegasi), etc.

Is there a way I can make some language translators for the languages we've made up?

If you don't know what I'm talking about: kind of like google translate, where you type things and it comes up in the other language.



I'm not good at coding, so I'd prefer something easy with clear step-by-step instructions.



Thank you in advance!



Also, sorry if this is the wrong category. xDHow do you build a fictional language translator on the computer?
umm, no this is not going to be easy.

If you're plan is to simply write out English but use different words, then it is pretty simple. It's a simple matter of substituting. You merely have all of the words you plan to use (which the English languages probably has thousands if not millions of words), then have substitutions for all of those words. Then when you want to write out a sentence, just substitute the words.

If you actually plan on writing a language, then translation between your language and English will be extremely non-trivial. Then there is the whole problem of defining your language. People go to college and get PhD's for analyzing this type of stuff (they are called linguists...compiler writers in CS are also pretty knowledgeable about this topic as well).

This is the correct category, but you're not going to get an answer because your question is extremely complicated.

A language is composed of a.) the alphabet: what characters will your written language accept, b) words, what are legal combinations of the characters in your alphabet (for instance xyz is not a "legal" English word), c.) grammar, what are legal combinations of words to make a sentence in your language (i.e. "a but your pencil leave" is NOT a legal combination of words), and finally, the HARDEST part is the d). the symantics...what do your sentences mean?

"I have a test today." - so what is the meaning behind this sentence, how do you differentiate that from "I have a house." What do these two sentences mean and how are they related...how do they fit into the same language, yet have very different meanings?

To translate between one language to another you have to know ALL of those things and in fact, this is impossible to actually do (i.e. there is no perfect conversion between English and Spanish...even though google has this feature, anyone who speaks both English and Spanish knows that this feature does not work all that well).
here are the steps:

1) learn to write code

2) write your own program

or

1) hire someone to write the code



its not easy to write. you'd need a large data base that will cover all the words in all the languages. you are looking at a ton of code.How do you build a fictional language translator on the computer?
If the language is a simple word-based substitution cipher for english (or whatever your native language is), then all you need to do is construct a one-to-one 'dictionary' matching your words with the fictional words, and have the program scan the dictionary and convert each word accordingly. If the dictionary were large enough you would probably use a binary search or something similar in order to speed up the processing. It wouldn't be a difficult program to write. Then if you wanted you could throw in a few extra simple rules to add some more flavor (preferably making sure each rule is reversible, i.e. it can be applied to translation in either direction). Translation between two fictional languages would probably be accomplished by first translating into english, and then back into the other language.

However, real languages never match up so conveniently, and in the real world the problem is astronomically more complicated. Not only that, but it differs from each pair of languages to the next. For instance, the word 'student' in english translates to french as either '茅tudiant' or '茅tudiante' depending on whether the student is male or female, respectively. Now imagine that we want to translate the following english text into french:

'The teacher sent an email to the student because he wanted to discuss her grades.'

It's pretty clear to us that the teacher is male and the student is female. But how is a computer supposed to tell? A smart computer might scan the sentence to find the closest gendered pronoun. In this case it turns out to be 'he'. So the computer might accordingly use '茅tudiant'- which would be wrong. See the difficulty here? And this problem is just the tip of the iceberg. Machine translation has been an ongoing field of study for decades, yet still no one has found a magic bullet, and even the best programs still make a lot of mistakes. It's considered to be close to an AI-complete problem, which is to say, any computer that can do it perfectly would have to be close to human-level intelligence. For the most part this applies to artificial languages as well, which like natural languages are usually complex enough that no simple algorithm is sufficient.How do you build a fictional language translator on the computer?
First you create a word list and organize it according to grammar. If your languages have the same grammar then that doesn't matter so much. You create a program and have it ask you which language you want to translate from and which to. It then opens both those databases. You enter your text into the program. It parses it -- breaks each word into tokens, and finds the word in your database and then finds the equivalent word on the output database. If it doesn't find the word, fine. Just print it as it was originally entered.



That's a very crude and simple translator but for you it should work. Maybe have a code of some kind across the databases which associates words in one with words in another. You would do that by creating a record (in Pascal) or a struct (in C or C++) with two fields, a string which has the word and an int or string which is the definition key.

No comments:

Post a Comment