Respuesta :
Using the knowledge in computational language in JAVA it is possible to write the code being methods define a method named getWordFrequency that takes an array of strings
Writting the code in JAVA:
import java.util.*;
public class WordFrequency {
public static int getWordFrequency(String[] wordsList , int listSize , String currWord) {
HashMap<String , Integer> hm = new HashMap<>();
for(String st : wordsList) {
String str = st.toLowerCase();
hm.put(str, hm.getOrDefault(str, 0) + 1);
}
for(String st : wordsList) {
String str = st.toLowerCase();
System.out.println(st + " " + hm.get(str));
}
String currWordToLowerCase = currWord.toLowerCase();
return hm.get(currWordToLowerCase);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
String[] wordsList = {"hey" , "Hi" , "Mark" , "hi" , "mark"};
int listSize = wordsList.length;
String currWord = "hey";
System.out.println("The frequency of " + currWord + " is : " + getWordFrequency(wordsList , listSize , currWord));
}
}
See more about JAVA at brainly.com/question/12978370
#SPJ1
