Ok, I know it's selfish to ask help in your first topic, but I've been browsing this site for days, and you know this is the best PHP site ever, so you can expect me to stay permanent. The reason why I'm now not posting a lot is that I'm just too busy
I'm sure you'll learn to love me 🙂
I need your help on writing a script.
The problem is is that the deadline is in 2 a 3 days, so i need help, or the full script would be (waay toooo, don't do it) nice ;p
This is the question:
I am working on a small routine that takes the text input from the user and converts it to another “language”. I don’t know if you play any of the games in the Final Fantasy series. In Final Fantasy X there is a “people” called the Al Bhed. Their “language” is a simple re-arrangement of the English alphabet. There are a a couple of rules. First, proper names do not get translated. Contain those words in single- or double-quotes. Second, contractions don’t exist in Al Bhed. This is where the routine I’m working on failed.
First, it didn’t allow for contractions to be able to deal with them. Second, it treats all single-quotes in the input text as though they are double-quotes. I want to change this by doing the following:
Single-quotes and double-quotes are treated separately so contractions can be more easily located within the string.
Have the most common contractions in a flat-file database that contains two fields:
Contraction (like can’t)
Uncontracted phrase (like cannot or can not)
I want to load the file into a either a 1-dimensional array that contains 2 fields, or a 2-dimensional array (preferred, I think), then use the array to determine contraction matches within the string, and if it finds a match to substitute the uncontracted phrase for the contraction.
- If it finds a single-quote and determines that an unknown contraction exists (no space character immediately before or after the single-quote, and the contraction doesn’t exist in the array), then determine what contraction it is (build the word by adding characters from the string in both directions until space characters occur), and prompt the user to provide the correct uncontracted phrase. The identified contraction and its matching uncontracted phrase would then be added to the database file.
Once all contractions have been dealt with, all remaining single- and double-quotes will be treated as proper nouns and will not be translated into Al Bhed.
Now, all this said, this routine is for use in a vbulletin editor. The file is a xml file with embedded php code in it.
I hope this explains what I am trying to do.