85 lines
3.6 KiB
Java
85 lines
3.6 KiB
Java
package tech.nevets.bspaperwriter;
|
|
|
|
import java.util.*;
|
|
|
|
public class Main {
|
|
String[] noun = {"Bill of Rights", "Bloodless Revolution", "Catholic", "Catholicism", "Dutch", "England", "France", "Glorious", "Glorious Revolution", "King James II", "Mary", "Protestant", "Spain", "William of Orange", "absolute monarchy", "battle", "constitutional monarchy", "crusade", "democracy", "parliament", "rebirth", "revolution", "they", "war"};
|
|
List<String> nounList= Arrays.asList(noun);
|
|
|
|
String[] verb = {"was", "had", "conquered", "saw", "wanted", "found", "gave", "called", "became", "felt", "needed", "tried", "gave", "knew", "began", "let", "believed", "wrote", "set"};
|
|
List<String> verbList = Arrays.asList(verb);
|
|
|
|
String[] adjective = {"good", "new", "first", "last", "last", "long", "great", "little", "own", "other", "old", "right", "big", "high", "different", "small", "large", "next", "early", "young", "important", "few", "public", "bad", "same", "able"};
|
|
List<String> adjectiveList = Arrays.asList(adjective);
|
|
|
|
String[] adverb = {"up", "so", "out", "just", "now", "how", "then", "more", "also", "here", "well", "only", "very", "even", "back", "there", "down", "still", "in", "as", "too", "when", "never", "really", "most"};
|
|
List<String> adverbList = Arrays.asList(adverb);
|
|
|
|
String[] preposition = {"about", "above", "across", "after", "against", "along", "among", "around", "as", "at", "before", "behind", "between", "but", "by", "during", "except", "for", "from", "in", "like", "next", "to", "of", "off", "on", "over", "past", "than", "through", "to", "until", "up", "with"};
|
|
List<String> prepositionList = Arrays.asList(preposition);
|
|
|
|
String[] conjunction = {"for", "and", "nor", "but", "or", "yet", "so"};
|
|
List<String> conjunctionList = Arrays.asList(conjunction);
|
|
|
|
public static void main(String[] args) {
|
|
Main m = new Main();
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
System.out.println(m.getSentence());
|
|
}
|
|
}
|
|
|
|
public String getNoun() {
|
|
int index = new Random().nextInt(nounList.size());
|
|
String newNoun = nounList.get(index);
|
|
return newNoun;
|
|
}
|
|
|
|
public String getVerb() {
|
|
int index = new Random().nextInt(verbList.size());
|
|
String newVerb = verbList.get(index);
|
|
return newVerb;
|
|
}
|
|
|
|
public String getAdjective() {
|
|
int index = new Random().nextInt(adjectiveList.size());
|
|
String newAdjective = adjectiveList.get(index);
|
|
return newAdjective;
|
|
}
|
|
|
|
public String getAdverb() {
|
|
int index = new Random().nextInt(adverbList.size());
|
|
String newAdverb = adverbList.get(index);
|
|
return newAdverb;
|
|
}
|
|
|
|
public String getPreposition() {
|
|
int index = new Random().nextInt(prepositionList.size());
|
|
String newPreposition = prepositionList.get(index);
|
|
return newPreposition;
|
|
}
|
|
|
|
public String getConjunction() {
|
|
int index = new Random().nextInt(conjunctionList.size());
|
|
String newConjunction = conjunctionList.get(index);
|
|
return newConjunction;
|
|
}
|
|
|
|
public String getSentence() {
|
|
int words = new Random().nextInt(8) + 14;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
for (int i = 0; i < words; i++) {
|
|
String[] pos = {getNoun(), getVerb(), getAdjective(), getAdverb(), getPreposition(), getConjunction()};
|
|
List<String> posList = Arrays.asList(pos);
|
|
|
|
int index = new Random().nextInt(posList.size());
|
|
String newPos = posList.get(index);
|
|
sb.append(newPos + " ");
|
|
}
|
|
|
|
sb.append(".");
|
|
String sentence = sb.toString();
|
|
return sentence;
|
|
}
|
|
} |