Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Word Suggestion Engine Determine the confidence and support of each word pair (bigram) Ask user for word (as if they were typing it) Build a List of possible "next words" at least 3 words in length If...

1 answer below »

Word Suggestion Engine

  1. Determine the confidence and support of each word pair (bigram)
  2. Ask user for word (as if they were typing it)
  3. Build a List of possible "next words" at least 3 words in length
    1. If the support of a word pair is >65% suggest that as one of the possible next word to be typed
      1. Similar to how your phone gives you a list of possible next words when typing
    2. If no words with support >65% suggest the three most common English connector words:
      1. the, this, of
    3. If less than 3 words found - pad the list with words from the most common Connectors (the this of)
    4. Print out the list with each word on its own line similar to:
      1. "Your next word might be .\n"

To test:

  • "Dad" should suggest "TMI"
  • "lunch" should suggest "LMK"
Answered Same Day Apr 26, 2021

Solution

Pushpendra answered on Apr 28 2021
164 Votes
import java.util.Scanner;
import java.util.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws IOException
{
HashMap map
= new HashMap
();
HashMap mp
= new HashMap
();
FileReader f1=new FileReader("message.txt");
Creation of File Descriptor for input file
BufferedReader
=new BufferedReader(f1);
            String s;
while((s=
.readLine())!=null)
Reading Content from the file
{
                String[] words=s.split(" ");
Integer i=0;
String prev;
prev=words[0];
for (String word : words)
{
if(i.equals(0))
{
i=i+1;
}
else
{
if(mp.containsKey(prev))
{
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here