Language GeneratorImplement a Language Generator class which will generate sentences with recursion and randomness.Read attached document for Background, Specification and Starter Code.Implement a LanguageGenerator class that generates valid strings according to the production rules defined by the given Grammar. A Grammar consists of a Supplier field with a get() method that returns a Map representing the production rules.Call the trim method to remove leading and trailing whitespace. Consider introducing a public/private pair to trim leading or trailing spaces from the final result.Split each string on one or more whitespace characters by calling split(“s+”).

BACKGROUND

import java.util.*;

import java.util.function.*;

public class LanguageGenerator {

    // TODO: Your code here

    public enum Grammar {

        FORMULA(() -> {

            Map<String, String[]> result = new TreeMap<>();

            result.put(“E”, “T, E OP T”.split(“, “));

            result.put(“T”, “x, y, 1, 2, 3, ( E ), F1 ( E ), – T, F2 ( E . E )”.split(“, “));

            result.put(“OP”, “+, -, *, %, /”.split(“, “));

            result.put(“F1”, “sin, cos, tan, sqrt, abs”.split(“, “));

            result.put(“F2”, “max, min, pow”.split(“, “));

            return result;

        }),

        MUSIC(() -> {

            Map<String, String[]> result = new TreeMap<>();

            result.put(“measure”, “pitch-w, half half”.split(“, “));

            result.put(“half”, “pitch-h, quarter quarter”.split(“, “));

            result.put(“quarter”, “pitch-q, pitch pitch”.split(“, “));

            result.put(“pitch”, “C, D#, F, F#, G, A#, C6”.split(“, “));

            result.put(“chordmeasure”, “chord-w, halfchord halfchord”.split(“, “));

            result.put(“halfchord”, “chord-h, chord-q chord-q“.split(“, “));

            result.put(“chord”, “Cmin, Cmin7, Fdom7, Gdom7”.split(“, “));

            result.put(“bassdrum”, “O..o, O…, O..o, OO..”.split(“, “));

            result.put(“snare”, “..S., S..s, .S.S”.split(“, “));

            result.put(“crash”, “…*, *…”.split(“, “));

            result.put(“claps”, “x..x, xx..x”.split(“, “));

            return result;

        }),

        ENGLISH(() -> {

            Map<String, String[]> result = new TreeMap<>();

            result.put(“SENTENCE”, “NOUNP VERBP”.split(“, “));

            result.put(“NOUNP”, “DET ADJS NOUN, PROPNOUN”.split(“, “));

            result.put(“PROPNOUN”, “Seattle, Matisse, Kim, Zela, Nia, Remi, Alonzo”.split(“, “));

            result.put(“ADJS”, “ADJ, ADJ ADJS”.split(“, “));

            result.put(“ADJ”, “fluffy, bright, colorful, beautiful, purple, calming”.split(“, “));

            result.put(“DET”, “the, a”.split(“, “));

            result.put(“NOUN”, “cat, dog, bagel, apple, person, school, car, train”.split(“, “));

            result.put(“VERBP”, “TRANSVERB NOUNP, INTRANSVERB”.split(“, “));

            result.put(“TRANSVERB”, “ate, followed, drove, smacked, embraced, helped”.split(“, “));

            result.put(“INTRANSVERB”, “shined, smiled, laughed, sneezed, snorted”.split(“, “));

            return result;

        });

        public final Supplier<Map<String, String[]>> productionRules;

        private Grammar(Supplier<Map<String, String[]>> productionRules) {

            this.productionRules = productionRules;

        }

    }

    public static void main(String[] args) {

        LanguageGenerator generator = new LanguageGenerator(Grammar.FORMULA);

        System.out.println(generator.generate(“T”));

    }

}

Get professional assignment help cheaply

Are you busy and do not have time to handle your assignment? Are you scared that your paper will not make the grade? Do you have responsibilities that may hinder you from turning in your assignment on time? Are you tired and can barely handle your assignment? Are your grades inconsistent?

Whichever your reason may is, it is valid! You can get professional academic help from our service at affordable rates. We have a team of professional academic writers who can handle all your assignments.

Our essay writers are graduates with diplomas, bachelor, masters, Ph.D., and doctorate degrees in various subjects. The minimum requirement to be an essay writer with our essay writing service is to have a college diploma. When assigning your order, we match the paper subject with the area of specialization of the writer.

Why choose our academic writing service?

Plagiarism free papers
Timely delivery
Any deadline
Skilled, Experienced Native English Writers
Subject-relevant academic writer
Adherence to paper instructions
Ability to tackle bulk assignments
Reasonable prices
24/7 Customer Support
Get superb grades consistently

Get Professional Assignment Help Cheaply
Are you busy and do not have time to handle your assignment? Are you scared that your paper will not make the grade? Do you have responsibilities that may hinder you from turning in your assignment on time? Are you tired and can barely handle your assignment? Are your grades inconsistent?
Whichever your reason may is, it is valid! You can get professional academic help from our service at affordable rates. We have a team of professional academic writers who can handle all your assignments.
Our essay writers are graduates with diplomas, bachelor’s, masters, Ph.D., and doctorate degrees in various subjects. The minimum requirement to be an essay writer with our essay writing service is to have a college diploma. When assigning your order, we match the paper subject with the area of specialization of the writer.
Why Choose Our Academic Writing Service?

Plagiarism free papers
Timely delivery
Any deadline
Skilled, Experienced Native English Writers
Subject-relevant academic writer
Adherence to paper instructions
Ability to tackle bulk assignments
Reasonable prices
24/7 Customer Support
Get superb grades consistently

How It Works
1.      Place an order
You fill all the paper instructions in the order form. Make sure you include all the helpful materials so that our academic writers can deliver the perfect paper. It will also help to eliminate unnecessary revisions.
2.      Pay for the order
Proceed to pay for the paper so that it can be assigned to one of our expert academic writers. The paper subject is matched with the writer’s area of specialization.
3.      Track the progress
You communicate with the writer and know about the progress of the paper. The client can ask the writer for drafts of the paper. The client can upload extra material and include additional instructions from the lecturer. Receive a paper.
4.      Download the paper
The paper is sent to your email and uploaded to your personal account. You also get a plagiarism report attached to your paper.

 

PLACE THIS ORDER OR A SIMILAR ORDER WITH Essay fount TODAY AND GET AN AMAZING DISCOUNT

The post Discuss on Language Generator appeared first on Essay fount.


What Students Are Saying About Us

.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐
"Honestly, I was afraid to send my paper to you, but you proved you are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"

.......... Customer ID: 11***| Rating: ⭐⭐⭐⭐⭐
"This company is the best there is. They saved me so many times, I cannot even keep count. Now I recommend it to all my friends, and none of them have complained about it. The writers here are excellent."


"Order a custom Paper on Similar Assignment at essayfount.com! No Plagiarism! Enjoy 20% Discount!"