Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago

Question

How was their resistance overcome?

Answered: 1 week ago