Write a JAVA program to implement the Ngram object.
The program should load the ARPA language model:
We have given an arpa file that contains text data, these textual data are divided into separated parts:
* 1 Gram:
probability value word backtracking value
0.5 sleep 1.333333
0.15222 withdraw 0.5578
* 2 Gram:
probability value word word backtracking value
0.33 sleep on 0.63333
0.758 withdraw money 1.8999
* 3 Gram:
probability value word word word backtracking value
0.14667 sleep on bed 0.4445
- The data file can be downloaded from:
[url removed, login to view]
Inputs & outputs
When the user’s input is one word, the application should retrieve this word with its probability value and
its backtracking value as in the file.
When the user’s input is two words, the application should retrieve and output these two words with
their probability value and their backtracking value as in the file.
and so on…
when the input is: sleep
the output should be: 0.5 sleep 1.333333
when the input is: sleep on
The output should be: 0.33333 sleep on 0.63333
Evaluation of the program:
Data structures used
Modular/ no hard coding
Requirement: You are not allowed to use objects/libraries that implement the main algorithm. Only the
standard Java library is allowed.
Submitted program will be tested in a generic notebook with 2GB RAM.
There is no need to design and interfaces.
“The comments within the code are so important for me to be clear and detailed because I need
to understand the code very well in order to present it and to make the documentation”. “the
deadline of submission is on 4th of March…but I need the program to be done before at
least 2 days in order to understand the code and to have a sufficient time to prepare the