Question: public class LibrariesLecture3{ // 5 points static int Q1(String word1, String word2) { // return the number of rhyming syllables between the two input words.

public class LibrariesLecture3{

// 5 points static int Q1(String word1, String word2) { // return the number of rhyming syllables between the two input words. We will define nthe number of rhyming // syllables as the number of syllables in the largest matching suffix of sounds between the words. This // is the same definition used by the provided library. // // Note: The cse115 library has been included in this project, but none of the classes have been imported.

return 0; }

public static void main(String[] args) {

}

}

package cse115.words;

import java.io.*; import java.util.*;

public class Words{

private static final String DIRECTORY = "/data/"; private static final String DICTIONARY_FILENAME = DIRECTORY + "cmudict-0.7b"; private static final String ADJECTIVES_FILENAME = DIRECTORY + "index.adj"; private static final String ADVERBS_FILENAME = DIRECTORY + "index.adv"; private static final String NOUNS_FILENAME = DIRECTORY + "index.noun"; private static final String SENSES_FILENAME = DIRECTORY + "index.sense"; private static final String VERB_FILENAME = DIRECTORY + "index.verb";

private static Map> dictionary = null; private static Map> partOfSpeech = null;

/** * Return the number of syllables in the input word. */ public static int numberOfSyllables(String word){ int syllables = 0; List sounds = Words.wordsToSounds(word); if(sounds == null){ return syllables; } for(String sound : sounds){ if(Words.isVowel(sound)){ syllables++; } } return syllables;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!