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"




Hey meet me at work Where you at You going to lunch LMK Where you at dude IDK You going to lunch LMK dude IDK You going to lunch LMK K sweet Where you at dude IDK dude IDK You going to lunch LMK K okay K sounds cool sounds cool On it Do you still have that game Are you going to the game Are you going to work K sweet Are you going to the game K sweet K sweet Are you going to work Are you going to the game K sounds cool K sounds cool Are you going to work Are you going to the game K sounds cool Are you going to work Are you going to the game K sounds cool Are you going to work Are you going to the game K sounds cool Are you going to work K sounds cool K sounds cool K sounds cool K sounds cool K sweet K sweet K sweet K sweet K sweet Are you going to school Are you going to eat What do you want to eat What do you want to eat Are you going to eat Are you going to school Are you going to eat What do you want to eat Leaving now What do you want to eat Are you going to eat Are you going to school Are you going to eat On my Way Are you going to eat Are you going to school Are you going to eat hello honey Are you going to eat Are you going to school Are you going to eat You going to lunch LMK Are you going to eat hello sweetie Are you going to eat Hey meet me at work Hey meet me at work You going to lunch LMK Where you at You going to lunch LMK Where you at Hey meet me at work Where you at Hey meet me at work Hey meet me at work Hey meet me at work I will see you there Oh I see bye ttyl ILY honey ILY sweetie how are the kids how are you doing whats up be there in a bit where are you huh IDK Dad TMI Mom TMI EWW Gross Dad TMI EWW Gross Mom TMI Yeah why Did you finish your homework yet Leaving now Leaving now Leaving now Did you finish your homework yet Leaving now Did you finish your homework yet Leaving now Did you finish your homework yet Leaving now Did you finish your homework yet Where you at Where you at Leaving now Leaving now Did you finish your homework yet Where you at Did you finish your homework yet Leaving now Did you finish your homework yet Where you at Dad TMI Dad TMI Dad TMI Dad TMI Dad TMI dude finished your homework Leaving now dude finished your homework what did you get for number two on your homework are you finished with your homework dude finished your homework dude finished your homework what did you get for number two on your homework what you doing this weekend LMK dude finished your homework what did you get for number two on your homework you got plans LMK dude finished your homework how are you doing what did you get for number two on your homework dude finished your homework Dad TMI Dad TMI Dad TMI Dad TMI Dad TMI what did you get for number two on your homework oh NVM what did you get for number two on your homework Where you at what did you get for number two on your homework really SMH Where you at well you know YOLO Where you at Did you finish your homework yet do you want us to order you lunch LMK plans LMK dude ROTFL where you going to lunch LMK lol I cannot believe that really LOL where you going to lunch LMK mmhmm SMH Dad TMI Dad TMI do you want us to order you lunch LMK Dad TMI Dad TMI where you going to lunch LMK Dad TMI EWW Gross Dad TMI where you going to lunch LMK EWW Gross Dad TMI where you going to lunch LMK do you want us to order you lunch LMK where you going to lunch LMK where you going to lunch LMK EWW Gross Dad TMI EWW Gross Dad TMI really LOL really LOL really LOL really LOL really LOL really LOL really LOL really LOL really LOL really LOL EWW Gross Dad TMI EWW Gross Dad TMI where you going to lunch LMK you getting lunch LMK do you want us to order you lunch LMK are you going in the order for lunch LMK K sounds cool bye see you later K sounds cool do you want us to order you lunch LMK K sounds cool do you want us to order you lunch LMK K sounds cool do you want us to order you lunch LMK K sounds cool bye ttyl bye ttyl do you want us to order you lunch LMK bye ttyl do you want us to order you lunch LMK bye ttyl do you want us to order you lunch LMK bye ttyl lunch LMK bye ttyl bye ttyl lunch LMK bye ttyl bye ttyl lunch LMK do you want us to order you lunch LMK bye ttyl do you want us to order you lunch LMK lunch LMK K sounds cool EWW Gross Dad TMI lunch LMK EWW Gross Dad TMI lunch LMK EWW Gross Dad TMI do you want us to order you lunch LMK EWW Gross Dad TMI do you want us to order you lunch LMK EWW Gross Dad TMI EWW Gross Dad TMI K sounds cool K sounds cool K sounds cool lunch LMK lunch LMK lunch LMK lunch LMK lunch LMK lunch LMK lunch LMK lunch LMK lunch LMK lunch LMK
Answered Same DayApr 26, 2021

Answer To: Word Suggestion Engine Determine the confidence and support of each word pair (bigram) Ask user for...

Pushpendra answered on Apr 28 2021
149 Votes
import java.util.Scanner;
import java.util.*;
import java.io.BufferedReader;
import java.io.File;
import j
ava.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 br=new BufferedReader(f1);
            String s;
while((s=br.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