- import java.util.ArrayList;
- import java.util.List;
- import java.util.Iterator;
- import java.util.Random;
- import java.util.StringTokenizer;
- /**
- * Write a description of class AlanisMorissetteLyrics here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class AlanisMorissetteLyrics
- {
- /**
- * Constructor for objects of class AlanisMorissetteLyrics
- */
- public AlanisMorissetteLyrics()
- {
- }
- /**
- * An example of a method - replace this comment with your own
- *
- * @param y a sample parameter for a method
- * @return the sum of x and y
- */
- /* public String subWords(List <String>)
- {
- }*/
- public String subNoun(String string, ArrayList<String> nouns)
- {
- String s = string;
- int index = 0;
- while (index <= nouns.size() -1)
- {
- return nouns.get(0);
- }
- return nouns.get(0);
- }
- public String subVerb(String string, ArrayList<String> verbs)
- {
- String s = string;
- int index = 0;
- while (index <= verbs.size() -1)
- {
- return verbs.get(0);
- }
- return verbs.get(0);
- }
- public String subAdj (String string, ArrayList<String> adjs)
- {
- String s = string;
- int index = 0;
- while (index <= adjs.size() -1)
- {
- return adjs.get(0);
- }
- return adjs.get(0);
- }
- public String subWords(String string, ArrayList<String> nouns, ArrayList<String> verbs,
- ArrayList <String> adjs)
- {
- String stringOne = "";
- String[] result = string.split("\\s");
- for (String word : result)
- {
- if (word.equals("noun"))
- {
- //System.out.println("" + subNoun(word, nouns));
- // return subNoun (word, nouns);
- //string.replace("noun", subNoun(word, nouns));
- String stringOne = string.replace("noun", subNoun(word, nouns));
- }
- if (word.equals("verb"))
- {
- System.out.println("" + subVerb(word, verbs));
- //string.replace("verb", subVerb(word, verbs));
- //System.out.println(string);
- String string1 = string.replace("verb", subVerb(word, verbs));
- }
- if (word.equals("adjective"))
- {
- //System.out.println("" + subAdj(word, adjs));
- //return subAdj (word, adjs);
- String string1 = string.replace("adjective", subAdj(word, adjs));
- }
- }
- return string;
- }
- //string.replace ("noun", nouns.get(0));
- //string.replace ("verb", verbs.get(0));
- //string.replace ("adjective", adjs.get(0));
- /*int resultIndex = 0;
- while (resultIndex <= result.size())
- {
- if (string.equals ("noun"))
- {
- string.replace("noun", nouns.getIndex(resultIndex));
- }
- resultIndex++;
- }
- if (string.equals("noun"))
- {
- System.out.println("string" + subNoun(string, nouns));
- return subNoun(string, nouns);
- }
- if (string.equals("verb"))
- {
- return subVerb(string, verbs);
- }
- if(string.equals("adjective"))
- {
- return subAdj(string, adjs);
- }
- return string;
- }*/
- /*public String generate(randomNouns, randomVerbs, randomAdjectives)
- {
- randomNouns = new Random();
- randomVerbs = new Random();
- randomAdjectives = new Random();
- }*/
- }