Implement an immutable data type outcast with the following API: public class Outcast { // constructor takes a WordNet object public Outcast (WordNet wordnet) // given an array of WordNet nouns,...


Implement an immutable data type outcast with the following API:<br>public class Outcast {<br>// constructor takes a WordNet object<br>public Outcast (WordNet wordnet)<br>// given an array of WordNet nouns, return an outcast<br>public String outcast (String[] nouns)<br>// test client (see below)<br>public static void main (String[] args)<br>Corner cases. Assume that the argument to outcast() contains only valid WordNet nouns and that it contains at least two such nouns.<br>Test client. The following test client takes from the command line the name of a synset file, the name of a hypernym file, followed by the names of outcast files, and prints an outcast in each file:<br>public static void main(String[] args) {<br>WordNet wordnet = new WordNet(args[0], args[1]);<br>Outcast outcast = new Outcast(wordnet);<br>for (int t = 2; t < args.length; t++) {<br>In in = new In(args[t]);<br>String[] nouns = in.readAllStrings();<br>StdOut.println(args[t] +
more outcast5.txt horse zebra cat bear table ~/Desktop/wordnet> more outcast8.txt water soda bed orange_juice milk apple_juice tea coffee ~/Desktop/wordnet> more outcast11.txt apple pear peach banana lime lemon blueberry strawberry mango watermelon potato ~/Desktop/wordnet> java-algs4 Outcast synsets.txt hypernyms.txt outcast5.txt outcast8.txt outcast11.txt outcast5.txt: table outcast8.txt: bed outcast11.txt: potato "/>
Extracted text: Implement an immutable data type outcast with the following API: public class Outcast { // constructor takes a WordNet object public Outcast (WordNet wordnet) // given an array of WordNet nouns, return an outcast public String outcast (String[] nouns) // test client (see below) public static void main (String[] args) Corner cases. Assume that the argument to outcast() contains only valid WordNet nouns and that it contains at least two such nouns. Test client. The following test client takes from the command line the name of a synset file, the name of a hypernym file, followed by the names of outcast files, and prints an outcast in each file: public static void main(String[] args) { WordNet wordnet = new WordNet(args[0], args[1]); Outcast outcast = new Outcast(wordnet); for (int t = 2; t < args.length;="" t++)="" {="" in="" in="new" in(args[t]);="" string[]="" nouns="in.readAllStrings();" stdout.println(args[t]="" +="" ":="" "="" +="" outcast.outcast(nouns));="" }="" }="" here="" is="" a="" sample="" execution:="" ~/desktop/wordnet=""> more outcast5.txt horse zebra cat bear table ~/Desktop/wordnet> more outcast8.txt water soda bed orange_juice milk apple_juice tea coffee ~/Desktop/wordnet> more outcast11.txt apple pear peach banana lime lemon blueberry strawberry mango watermelon potato ~/Desktop/wordnet> java-algs4 Outcast synsets.txt hypernyms.txt outcast5.txt outcast8.txt outcast11.txt outcast5.txt: table outcast8.txt: bed outcast11.txt: potato
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here