Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

subWords method2

By: ace on Jun 8th, 2010  |  syntax: None  |  size: 1.03 KB  |  hits: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public String subWords(String string, ArrayList<String> nouns, ArrayList<String> verbs,
  2. ArrayList <String> adjs)
  3. {
  4. int index = 0;
  5. String[] result = string.split("\\s");
  6. ArrayList<String> words = new ArrayList<String>();
  7. for (String word : result)
  8.     {
  9.         words.add(word);
  10.     }
  11.    
  12.     while (index <= words.size()-1)
  13.         {
  14.             if (words.get(index) == "noun")
  15.                 {
  16.                     words.get(index) = testNouns.get(index);
  17.                 }
  18.                
  19.              if (word = "verb")
  20.                 {
  21.                     words.replace ("verb", testVerbs.get(index));
  22.                 }
  23.                
  24.               if (word = "adjective")
  25.               {
  26.                   words.replace ("adjective", TestAdjs.get(index));
  27.                 }
  28.              
  29.                 else
  30.                     {
  31.                         word = word;
  32.                     }
  33.                     index++;
  34.                    
  35.                     return words;
  36.                 }
  37.             }