Hello, good evening.
I used StringTokenizer in my "SMS Textspeak Corrector". This application has a database "db.txt" as I mentioned in my other topics.
This is the database what it looks like if you try to open my database:
As you can see in my database, there is a "|" in the middle of two words. Which means "u" is a textspeak and the "you" is the original word and the bar their is the delimiter. As you can see as well, I just copied the words and just putted a question mark. Because in the SMS there's a period, question, and exclamation marks on every end of the sentence. And the StringTokenizer will read the word (along with the question mark) as a whole word. If the program found a match in the database it will replace the textspeak to its original word. Hope you guys got it. Just tell if you didn't get it.
What I want is to erase the "u?|you?|wer?|where?|wen?|when?|dat?|that?|"
and retain the "u|you|wer|where|wen|when|dat|that|" so that the database won't be so heavy.
But the problem is those words that ends with period, question, and exclamation marks will not be replace.
So how will I solve this problem?
Here's the code of my StringTokenizer:
data = file();
text = message.getString();
StringTokenizer stText = new StringTokenizer(text," ");
int found = 0;
readWord = stText.nextToken();
StringTokenizer st = new StringTokenizer(data,"|");
while ((st.hasMoreTokens()) && (found==0))
txtspkWord = st.nextToken();
realWord = st.nextToken();
found = 1;
newtxt = newtxt + "" + realWord + " ";
newtxt = newtxt + "" + readWord + " ";
temp = newtxt;
newtxt = "";
capital = capitalize(temp);
message = new TextBox ("Message", capital, 2000,TextField.ANY);