
subWords method2
By:
ace on
Jun 8th, 2010 | syntax:
None | size: 1.03 KB | hits: 26 | expires: Never
public String subWords(String string, ArrayList<String> nouns, ArrayList<String> verbs,
ArrayList <String> adjs)
{
int index = 0;
String[] result = string.split("\\s");
ArrayList<String> words = new ArrayList<String>();
for (String word : result)
{
words.add(word);
}
while (index <= words.size()-1)
{
if (words.get(index) == "noun")
{
words.get(index) = testNouns.get(index);
}
if (word = "verb")
{
words.replace ("verb", testVerbs.get(index));
}
if (word = "adjective")
{
words.replace ("adjective", TestAdjs.get(index));
}
else
{
word = word;
}
index++;
return words;
}
}