Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package java.recursive.sentence.generator;
- import java.lang.Math;
- public class JavaRecursiveSentenceGenerator {
- static void Sentence() {
- //Follows the rule to implement <Sentence> ::= simple sentence
- simpleSentence();
- // 50% of sentences continue with yet another sentence
- if (Math.random() > 0.50) {
- System.out.print(" and ");
- simpleSentence();
- }
- }
- static void simpleSentence() {
- System.out.println("a simp");
- }
- public static void main(String[] args) {
- String[] properNouns = { "Fred", "Jane", "Richard Nixon", "Miss America" };
- String[] commonNouns = { "man", "woman", "fish", "elephant", "unicorn" };
- String[] adjectives = {"big", "tiny", "pretty", "bald"};
- String[] determiner = {"a", "the", "very", "some"};
- String[] intransitiveVerb = {"runs", "talks", "jumps", "sleeps"};
- String[] transitiveVerb = {"loves", "hates", "sees", "knows", "looks for", "finds"};
- String[] conjunction = {"and", "or", "but", "because"};
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement