java dictionary
Assignment 4/Assignment 4-S2013(1) (1).docx
Assignment 4
CS204
New concepts tested by this program
Hash Tables
You will be creating a program that does a simple Spell check and GRE word check. You will be storing the dictionaries in hash tables implemented with buckets/chaining.
Data Element - HashableWord
You will be creating a class HashableWord which implements HashableWordInterface. The hashCode method should return an integer based on the following hash function:
final int HASH_MULTIPLIER = 31; int h = 0; for (int i = 0; i < word.length(); i++) h = HASH_MULTIPLIER * h + s.charAt(i)
Data Structure - HashTable
You will be implementing a class HashTable which implements HashTableInterface with buckets. You can use an array of linked lists(of HashableWordInterfaces). You will need a method to add to the hashtable and other methods you think are necessary.
Data Managers – Dictonary & DictionaryUtility
Create a class Dictionary that implements the DictionaryInterface that has the methods: checkWord, checkWords, create, add and printToFile. This class will use an object of your HashTable class to hold the words for the Dictionary.
Create a class DictionaryUtility that implements the DictionaryUtilityInterface that has methods checkGRE for one sentence or an ArrayList of Sentences. This class will use an object of your HashTable class to hold the words for the DictionaryUtility (GRE words).
GUI Driver
Create two Dictionaries, one for Common words and one for GRE words. Use the FileChooser to ask the user for the location of the Common Words Dictionary File and the GRE Dictionary File before the initial screen appears. If the user selects the Read Text File button, use the FileChooser to ask the user for the location of the text file to be read and then display the contents of the file in the text area. If the user selects the Spell Check button and the program finds words that are not in the Common Words Dictionary, it will list the word as not in the dictionary and will ask the user if they want to add these words to the dictionary. The JTextArea can also be used for entering text by the user. For simplicity, put each sentence on a different line. If the user selects the GRE button, the program will check to make sure that each sentence has a word from the GRE dictionary. If sentences don’t contain a GRE word, the user will be shown all those sentences. When the user selects Exit, the common words dictionary is stored with any new words that the user has requested to be added to the dictionary.
Some Suggestions:
1. Convert to uppercase (or lowercase) before inserting words in the dictionary files, and then convert words in the text area to uppercase (or lowercase) to compare.
2. To extract words using next, you might consider using the method .useDelimiter(“[^A-Za-z]+”); it extracts when it starts with an alpha and continues to extract while there is an alpha.
3. If sentences are on separate lines, you can use .nextLine
4. When extracting from a text file and building a string to set the text of the JTextArea, don’t forget to put “\n” at the end of all lines.
User choses the files for the Spell check (common words) and the Gre word check
Results of Spell Check:
(
Or
)
Result of GRE Check:
Program Grade Sheet
Assignment #4
CS204
Name _________________________________ Date/Time _________________
DOCUMENTATION
Javadoc for user created classes: 4 pt _____
Test Cases 4 pt _____
JUnit Test Class
Test the methods of your Dictionary, and DictionaryUtility classes
Implement the student tests in DictionaryTest
UML Diagram 2 pt _____
PROGRAMMING
Programming Style
Internal class documentation (within source code) 3 pt _____
Class description using Javadoc
Author’s Name, Class, Class Time
Methods commented using Javadoc
Program user interface
Clear to user how data is to be entered 1 pt _____
Output is easy to understand 1 pt _____
Accuracy
Public Tests 5 pt _____
Private Tests 5 pt _____
Program Details
1. HashableWord class
a. Uses HashableWordInterface 2 pt _____
b. Implements all methods of HashableWordInterface
2. HashTable class
a. Uses HashTableInterface 8 pt _____
b. implemented with buckets and linkedList
c. implements all methods of HashTableInterface
3. Dictionary class
a. Uses DictionaryInterface 7 pt _____
b. Uses an object of your HashTable data structure
c. Implements all methods of DictionaryInterface
4. DictionaryUtility 5 pt _____
a. Uses DictionaryUtilityInterface
b. Uses an object of your HashTable data structure
c. Implements all methods of DictionaryUtilityInterface
5. GUI driver 3 pt _____
a. Uses FileChooser to select files that contain dictionaries and text files
b. Reads from a file and puts contents in text area
c. Allows user to do Spell Check
d. Allows user to check for GRE words
Total 50 pt _____
Comments:
image5.png
image6.png
image7.png
image8.png
image1.png
image2.png
image3.png
image4.png
Assignment 4/commonWords.txt
A ABLE ABOUT ABOVE ACCORDING ACCOUNT ACROSS ACT ACTION ACTIVITIES ACTIVITY ACTUALLY ADDED ADDITION ADDITIONAL ADMINISTRATION AFTER AGAIN AGAINST AGE AGO AHEAD AID AIR ALL ALMOST ALONE ALONG ALREADY ALSO ALTHOUGH ALWAYS AM AMERICA AMERICAN AMONG AMOUNT AN ANALYSIS AND ANOTHER ANSWER ANTI ANY ANYONE ANYTHING APPARENTLY APPEAR APPEARED APPROACH ARE AREA AREAS ARMS ARMY AROUND ART AS ASK ASKED ASSOCIATION AT ATTACK ATTENTION AUDIENCE AVAILABLE AVERAGE AWAY B BACK BAD BALL BASED BASIC BASIS BE BEAUTIFUL BECAME BECAUSE BECOME BED BEEN BEFORE BEGAN BEGINNING BEHIND BEING BELIEVE BELOW BEST BETTER BETWEEN BEYOND BIG BILL BLACK BLOOD BLUE BOARD BODY BOOK BORN BOTH BOY BOYS BRING BRITISH BROUGHT BROWN BUILDING BUILT BUSINESS BUT BY C CALL CALLED CAME CAN CANNOT CANT CAR CARE CARRIED CARS CASE CASES CAUSE CENT CENTER CENTRAL CENTURY CERTAIN CERTAINLY CHANCE CHANGE CHANGES CHARACTER CHARGE CHIEF CHILD CHILDREN CHOICE CHRISTIAN CHURCH CITY CLASS CLEAR CLEARLY CLOSE CLOSED CLUB CO COLD COLLEGE COLOR COME COMES COMING COMMITTEE COMMON COMMUNIST COMMUNITY COMPANY COMPLETE COMPLETELY CONCERNED CONDITIONS CONGRESS CONSIDER CONSIDERED CONTINUED CONTROL CORNER CORPS COST COSTS COULD COULDNT COUNTRIES COUNTRY COUNTY COUPLE COURSE COURT COVERED CUT D DAILY DARK DATA DAY DAYS DE DEAD DEAL DEATH DECIDED DECISION DEEP DEFENSE DEGREE DEMOCRATIC DEPARTMENT DESCRIBED DESIGN DESIGNED DETERMINED DEVELOPED DEVELOPMENT DID DIDNT DIFFERENCE DIFFERENT DIFFICULT DIRECT DIRECTION DIRECTLY DISTANCE DISTRICT DO DOES DOING DONE DONT DOOR DOUBT DOWN DR DRIVE DUE DURING E EACH EARLIER EARLY EARTH EAST EASY ECONOMIC EDUCATION EFFECT EFFECTIVE EFFECTS EFFORT EFFORTS EIGHT EITHER ELEMENTS ELSE END ENGLAND ENGLISH ENOUGH ENTIRE EQUIPMENT ESPECIALLY ESTABLISHED EUROPE EVEN EVENING EVER EVERY EVERYTHING EVIDENCE EXAMPLE EXCEPT EXISTENCE EXPECT EXPECTED EXPERIENCE EXTENT EYE EYES F FACE FACT FAITH FALL FAMILY FAR FARM FATHER FEAR FEDERAL FEED FEEL FEELING FEET FELT FEW FIELD FIGURE FIGURES FILLED FINAL FINALLY FIND FINE FIRE FIRM FIRST FISCAL FIVE FLOOR FOLLOWED FOLLOWING FOOD FOOT FOR FORCE FORCES FOREIGN FORM FORMER FORMS FORWARD FOUND FOUR FREE FREEDOM FRENCH FRIEND FRIENDS FROM FRONT FULL FUNCTION FURTHER FUTURE G GAME GAVE GENERAL GENERALLY GEORGE GET GETTING GIRL GIRLS GIVE GIVEN GIVES GLASS GO GOD GOING GONE GOOD GOT GOVERNMENT GREAT GREATER GREEN GROUND GROUP GROUPS GROWING GROWTH GUN H HAD HAIR HALF HALL HAND HANDS HAPPENED HARD HAS HAVE HAVING HE HEAD HEAR HEARD HEART HEAVY HELD HELL HELP HER HERE HERSELF HES HIGH HIGHER HIM HIMSELF HIS HISTORY HIT HOLD HOME HOPE HORSE HOSPITAL HOT HOTEL HOUR HOURS HOUSE HOW HOWEVER HUMAN HUNDRED HUSBAND I IDEA IDEAS IF ILL IM IMAGE IMMEDIATELY IMPORTANT IN INCLUDE INCLUDING INCOME INCREASE INCREASED INDEED INDIVIDUAL INDUSTRIAL INDUSTRY INFLUENCE INFORMATION INSIDE INSTEAD INTEREST INTERNATIONAL INTO INVOLVED IS ISLAND ISSUE IT ITS ITSELF IVE J JOB JOHN JUST JUSTICE KEEP KENNEDY KEPT KIND KNEW KNOW KNOWLEDGE KNOWN L LABOR LACK LAND LANGUAGE LARGE LARGER LAST LATE LATER LATTER LAW LAY LEAD LEADERS LEARNED LEAST LEAVE LED LEFT LENGTH LESS LET LETTER LETTERS LEVEL LIFE LIGHT LIKE LIKELY LINE LINES LIST LITERATURE LITTLE LIVE LIVED LIVING LOCAL LONG LONGER LOOK LOOKED LOOKING LOST LOT LOVE LOW LOWER M MADE MAIN MAJOR MAKE MAKES MAKING MAN MANNER MANS MANY MARCH MARKET MARRIED MASS MATERIAL MATTER MAY MAYBE ME MEAN MEANING MEANS MEDICAL MEET MEETING MEMBER MEMBERS MEN MERELY MET METHOD METHODS MIDDLE MIGHT MILES MILITARY MILLION MIND MINUTES MISS MODERN MOMENT MONEY MONTH MONTHS MORAL MORE MORNING MOST MOTHER MOVE MOVED MOVEMENT MOVING MR MRS MUCH MUSIC MUST MY MYSELF N NAME NATION NATIONAL NATIONS NATURAL NATURE NEAR NEARLY NECESSARY NEED NEEDED NEEDS NEGRO NEITHER NEVER NEW NEXT NIGHT NO NON NOR NORMAL NORTH NOT NOTE NOTHING NOW NUCLEAR NUMBER NUMBERS OBTAINED OBVIOUSLY OF OFF OFFICE OFTEN OH OLD ON ONCE ONE ONES ONLY OPEN OPENED OPERATION OPPORTUNITY OR ORDER ORGANIZATION OTHER OTHERS OUR OUT OUTSIDE OVER OWN P PAID PAPER PART PARTICULAR PARTICULARLY PARTS PARTY PASSED PAST PATTERN PAY PEACE PEOPLE PER PERFORMANCE PERHAPS PERIOD PERSON PERSONAL PERSONS PHYSICAL PICTURE PIECE PLACE PLACED PLAN PLANE PLANNING PLANS PLANT PLAY POINT POINTS POLICE POLICY POLITICAL POOL POOR POPULATION POSITION POSSIBLE POST POWER PRESENT PRESIDENT PRESS PRESSURE PRICE PRINCIPLE PRIVATE PROBABLY PROBLEM PROBLEMS PROCESS PRODUCTION PRODUCTS PROGRAM PROGRAMS PROGRESS PROPERTY PROVIDE PROVIDED PUBLIC PURPOSE PUT QUALITY QUESTION QUESTIONS QUITE R RACE RADIO RAN RANGE RATE RATHER REACHED REACTION READ READING READY REAL REALLY REASON RECEIVED RECENT RECENTLY RECORD RED RELIGION RELIGIOUS REMEMBER REPORT REPORTED REQUIRED RESEARCH RESPECT RESPONSIBILITY REST RESULT RESULTS RETURN RETURNED RIGHT RIVER ROAD ROOM RUN RUNNING S SAID SALES SAME SAT SAW SAY SAYING SAYS SCHOOL SCHOOLS SCIENCE SEASON SECOND SECRETARY SECTION SEE SEEM SEEMED SEEMS SEEN SELF SENSE SENT SERIES SERIOUS SERVED SERVICE SERVICES SET SEVEN SEVERAL SHALL SHE SHORT SHOT SHOULD SHOW SHOWED SHOWN SIDE SIMILAR SIMPLE SIMPLY SINCE SINGLE SITUATION SIX SIZE SLOWLY SMALL SO SOCIAL SOCIETY SOME SOMETHING SOMETIMES SOMEWHAT SON SOON SORT SOUND SOUTH SOUTHERN SOVIET SPACE SPEAK SPECIAL SPECIFIC SPIRIT SPRING SQUARE ST STAFF STAGE STAND STANDARD START STARTED STATE STATEMENTS STATES STAY STEP STEPS STILL STOCK STOOD STOP STOPPED STORY STRAIGHT STREET STRENGTH STRONG STUDENT STUDENTS STUDY SUBJECT SUCH SUDDENLY SUMMER SUN SUPPORT SURE SURFACE SYSTEM SYSTEMS T TABLE TAKE TAKEN TAKING TALK TAX TECHNICAL TELL TEMPERATURE TEN TERM TERMS TEST TH THAN THAT THATS THE THEIR THEM THEMSELVES THEN THEORY THERE THEREFORE THERES THESE THEY THING THINGS THINK THINKING THIRD THIRTY THIS THOSE THOUGHT THREE THROUGH THROUGH THROUGHOUT THUS TIME TIMES TO TODAY TOGETHER TOLD TOO TOOK TOP TOTAL TOWARD TOWN TRADE TRAINING TREATMENT TRIAL TRIED TROUBLE TRUE TRUTH TRY TRYING TURN TURNED TWENTY TWO TYPE TYPES U UNDER UNDERSTAND UNDERSTANDING UNION UNITED UNIVERSITY UNTIL UP UPON US USE USED USING USUALLY VALUE VALUES VARIOUS VERY VIEW VOICE VOLUME WAITING WALKED WALL WANT WANTED WAR WAS WASHINGTON WASNT WATER WAY WAYS WE WEEK WEEKS WELL WENT WERE WEST WESTERN WHAT WHATEVER WHEN WHERE WHETHER WHICH WHILE WHITE WHO WHOLE WHOM WHOSE WHY WIDE WIFE WILL WILLIAM WINDOW WISH WITH WITHIN WITHOUT WOMAN WOMEN WORD WORDS WORK WORKED WORKING WORKS WORLD WOULD WOULDNT WRITING WRITTEN WRONG WROTE YEAR YEARS YES YET YORK YOU YOUNG YOUR YOURE
Assignment 4/Dictionary/.classpath
Assignment 4/Dictionary/.project
Dictionary org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature
Assignment 4/Dictionary/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6
Assignment 4/Dictionary/bin/DictionaryInterface.class
public abstract interface DictionaryInterface { public abstract boolean checkWord(String); public abstract java.util.ArrayList checkWords(java.util.ArrayList); public abstract boolean create(java.io.File); public abstract void add(String); public abstract boolean printToFile(java.io.File); }
Assignment 4/Dictionary/bin/DictionaryTest.class
public synchronized class DictionaryTest { private static java.util.ArrayList words; private static java.util.ArrayList result; private static java.util.ArrayList test1; private static Dictionary commonWords; private static Dictionary greWords; private static DictionaryUtility greUtility; private static java.io.File commonFile; private static java.io.File greFile; private static java.io.File testFile; public void DictionaryTest(); public static void oneTimeSetUp() throws Exception; public static void oneTimeTearDown() throws Exception; public void testCheckWords(); public void testCheckWordsStudent(); public void testCheckWord(); public void testCheckWordStudent(); public void testAdd(); public void testCheckGreArrayList(); public void testCheckGreArrayListStudent(); public void testCheckGreStringStudent(); public void testPrintToFile(); public static void createCommon(); public static void createGRE(); }
Assignment 4/Dictionary/bin/DictionaryUtilityInterface.class
public abstract interface DictionaryUtilityInterface { public abstract java.util.ArrayList checkGRE(java.util.ArrayList, DictionaryInterface); public abstract boolean checkGRE(String, DictionaryInterface); }
Assignment 4/Dictionary/bin/HashableWordInterface.class
public abstract interface HashableWordInterface { public abstract int hashCode(); public abstract boolean equals(HashableWordInterface); public abstract String getString(); }
Assignment 4/Dictionary/bin/HashTableInterface.class
public abstract interface HashTableInterface { public abstract int add(HashableWordInterface); public abstract boolean contains(HashableWordInterface); public abstract java.util.ArrayList sort(); }
Assignment 4/Dictionary/src/DictionaryInterface.java
Assignment 4/Dictionary/src/DictionaryInterface.java
import
java
.
io
.
File
;
import
java
.
util
.
ArrayList
;
/** methods of a Dictionary
*
*
@author
Professor Myers
*
*/
public
interface
DictionaryInterface
{
/**
* check if a word is in the dictionary
*
@param
s String
*
@return
true if word is in dictionary or false if not
*/
public
boolean
checkWord
(
String
s
);
/**
* check if words in an ArrayList are in the dictionary
*
@param
words ArrayList of words to be checked
*
@return
an ArrayList of all words not in dictionary
*/
public
ArrayList
<
String
>
checkWords
(
ArrayList
<
String
>
words
);
/**
* create hash table of strings in the file contents
*
@param
f File
*
@return
true if File is found and words added, returns false if file not found
*/
public
boolean
create
(
File
f
);
/**
* add word to dictionary
*
@param
word String to add to dictionary
*/
public
void
add
(
String
word
);
/**
* write words in dictionary to a file
*/
public
boolean
printToFile
(
File
f
);
}
Assignment 4/Dictionary/src/DictionaryTest.java
Assignment 4/Dictionary/src/DictionaryTest.java
import
static
org
.
junit
.
Assert
.
*
;
import
java
.
io
.
File
;
import
java
.
util
.
ArrayList
;
import
javax
.
swing
.
JFileChooser
;
import
javax
.
swing
.
JOptionPane
;
import
org
.
junit
.
After
;
import
org
.
junit
.
AfterClass
;
import
org
.
junit
.
Before
;
import
org
.
junit
.
BeforeClass
;
import
org
.
junit
.
Test
;
public
class
DictionaryTest
{
private
static
ArrayList
<
String
>
words
;
private
static
ArrayList
<
String
>
result
,
test1
;
private
static
Dictionary
commonWords
;
private
static
Dictionary
greWords
;
private
static
DictionaryUtility
greUtility
;
private
static
File
commonFile
,
greFile
,
testFile
;
@
BeforeClass
public
static
void
oneTimeSetUp
()
throws
Exception
{
greUtility
=
new
DictionaryUtility
();
commonWords
=
new
Dictionary
();
greWords
=
new
Dictionary
();
words
=
new
ArrayList
<
String
>
();
test1
=
new
ArrayList
<
String
>
();
test1
.
add
(
"I abhor tests."
);
test1
.
add
(
"They make me sick to my abdomen."
);
test1
.
add
(
"So I must adhere to my study schedule."
);
test1
.
add
(
"I hate tests."
);
String
[]
w
=
{
"they"
,
"make"
,
"me"
,
"sick"
,
"to"
,
"my"
,
"abdomen"
};
for
(
int
i
=
0
;
i
<
w
.
length
;
i
++
)
words
.
add
(
w
[
i
]);
createCommon
();
createGRE
();
}
@
AfterClass
public
static
void
oneTimeTearDown
()
throws
Exception
{
words
=
null
;
greUtility
=
null
;
commonWords
=
null
;
greWords
=
null
;
test1
=
null
;
}
@
Test
public
void
testCheckWords
()
{
result
=
commonWords
.
checkWords
(
words
);
assertTrue
(
result
.
get
(
0
).
equals
(
"sick"
));
assertTrue
(
result
.
get
(
1
).
equals
(
"abdomen"
));
}
@
Test
// TO BE IMPLEMENTED BY STUDENT
public
void
testCheckWordsStudent
()
{
// Provide additional test for the checkWords() method
// with different data than above
fail
(
"Not yet implemented by Student"
);
}
@
Test
public
void
testCheckWord
(){
assertTrue
(
commonWords
.
checkWord
(
"heavy"
));
assertFalse
(
commonWords
.
checkWord
(
"applicable"
));
}
@
Test
// TO BE IMPLEMENTED BY STUDENT
public
void
testCheckWordStudent
()
{
// Provide additional test for the checkWord() method
// with different data than above
fail
(
"Not yet implemented by Student"
);
}
@
Test
public
void
testAdd
(){
assertFalse
(
commonWords
.
checkWord
(
"applicable"
));
commonWords
.
add
(
"applicable"
);
assertTrue
(
commonWords
.
checkWord
(
"applicable"
));
//restore commonWords back to original
commonWords
.
create
(
commonFile
);
}
@
Test
public
void
testCheckGreArrayList
()
{
result
=
greUtility
.
checkGRE
(
test1
,
greWords
);
assertEquals
(
result
.
get
(
0
),
"I hate tests"
);
}
@
Test
// TO BE IMPLEMENTED BY STUDENT
public
void
testCheckGreArrayListStudent
()
{
// Provide additional test for the checkGRE(ArrayList<String> a, Dictionary d)
// method, with different data than above
fail
(
"Not yet implemented by Student"
);
}
@
Test
// TO BE IMPLEMENTED BY STUDENT
public
void
testCheckGreStringStudent
()
{
// test the DictionaryUtility method checkGRE(String s, Dictionary d)
// must be at least 2 tests
fail
(
"Not yet implemented by Student"
);
}
@
Test
public
void
testPrintToFile
()
{
String
parentPath
;
commonWords
.
add
(
"basketball"
);
parentPath
=
commonFile
.
getParent
();
testFile
=
new
File
(
parentPath
+
"/test.txt"
);
//create test.txt file in same directory as commonwords file
commonWords
.
printToFile
(
testFile
);
//create a new commonWords dictionary with test.txt
commonWords
.
create
(
testFile
);
assertTrue
(
commonWords
.
checkWord
(
"heavy"
));
assertTrue
(
commonWords
.
checkWord
(
"basketball"
));
//restore commonWords back to original
commonWords
.
create
(
commonFile
);
}
public
static
void
createCommon
()
{
JFileChooser
cf
=
new
JFileChooser
();
cf
.
setDialogTitle
(
"Choose Common word dictionary file"
);
cf
.
showOpenDialog
(
null
);
//show file chooser for dictionary
commonFile
=
cf
.
getSelectedFile
();
commonWords
.
create
(
commonFile
);
//create hash table of dictionary
}
public
static
void
createGRE
()
{
JFileChooser
cf
=
new
JFileChooser
();
cf
.
setDialogTitle
(
"Choose GRE dictionary file"
);
cf
.
showOpenDialog
(
null
);
//show file chooser for dictionary
greFile
=
cf
.
getSelectedFile
();
greWords
.
create
(
greFile
);
//create hash table of dictionary
}
}
Assignment 4/Dictionary/src/DictionaryUtilityInterface.java
Assignment 4/Dictionary/src/DictionaryUtilityInterface.java
import
java
.
util
.
ArrayList
;
/** Used for specialty methods of a dictionary
*
*
@author
Professor Myers
*
*/
public
interface
DictionaryUtilityInterface
{
/** returns an array of Strings which are sentences that don't contain a sentence
*
*
@param
a ArrayList of Strings (sentences)
*
@param
d the Dictionary to compare against
*
@return
the ArrayList of Strings (sentences) that don't contain a gre word
*/
public
ArrayList
<
String
>
checkGRE
(
ArrayList
<
String
>
a
,
DictionaryInterface
d
);
/** returns true if the String (sentence) contains a gre word
*
*
@param
s String (sentence)
*
@param
d dictionary to compare it against
*
@return
true if gre word is in string (sentence) false if not.
*/
public
boolean
checkGRE
(
String
s
,
DictionaryInterface
d
);
}
Assignment 4/Dictionary/src/HashableWordInterface.java
Assignment 4/Dictionary/src/HashableWordInterface.java
/** Guarantees that Words that implement HashableWord have definitions for hashCode and equals
*
*
@author
Professor Myers
*
*/
public
interface
HashableWordInterface
{
/**
* compute the hash code of the word
*
@return
hash code
*/
public
int
hashCode
();
/**
* Compares a String portion of a HashableWord to a String
* portion of another HashableWord
*
@param
s String to compare
*
@return
true is Strings are same or else false
*/
public
boolean
equals
(
HashableWordInterface
s
);
/**
* returns the string portion of the HashableWord
*
@return
string portion of the HashableWord
*/
public
String
getString
();
}
Assignment 4/Dictionary/src/HashTableInterface.java
Assignment 4/Dictionary/src/HashTableInterface.java
import
java
.
util
.
ArrayList
;
/** methods for a HashTable of Strings. An array of LinkedLists
*
*
@author
Professor Myers
*
*/
public
interface
HashTableInterface
{
/**
* Adds an element to this set. Adds to the appropriate LinkedList by taking the wordHashCode()
* and mod (%) by the table size.
*
@param
s a HashableWord to add to the HashTable
*
@return
the number of words currently in HashTable
*/
public
int
add
(
HashableWordInterface
s
);
/**
* Tests to see if the HashableWord is in the HashTable.
*
@param
s a HashableWord
*
@return
true if word contains in the dictionary
*/
public
boolean
contains
(
HashableWordInterface
s
);
/**
* Puts the words in the hashtable in a sorted ArrayList
*
@return
ArrayList of words in hashtable in sorted order
*/
public
ArrayList
<
String
>
sort
();
}
Assignment 4/GRE_WordList.txt
abacus abate abdication abdomen aberration abeyance abhor abide abjure abraded abrasion abrogate abscond abstruse abundant abut abysmal acarpous accentuate acclaimed accolade accretion acquiescein acquisition adamant adhere adhesion adjacent admonitory adorn adulteration affinity aggravate agile ail alacrity alienate allegiance alleviate alloy aloof amalgamate ambidextrous ambiguous ambivalent ameliorate amendment amicable amortize amplify animosity annul anticlimax antidote antithetical apartheid apathetic aplomb apostate apotheosis appease apprehensive apprise approbation appropriate apropos apt arabesque arabesque arbitrate arboreal ardently ardor arduous argot arrant arrogance articulate ascend ascent ascertain ascetic ascribe asperity aspersion assailwith asset assiduous assuage assumption asterisk astringent astute atonement attenuate audacious augury august auspice auspicious austere auxiliary aver aversion avid avow baleful balk balloon balm banal band bane baneful barrage barren baskin bazaar beirreconcilab beatify bedizen belie belittle bellicose belligerent belligerently bend benefactor benevolence benign bequest berate bereft bewilder biased bigot bilge blandishment blandness blatant blithe blithe blueprint blunt boggle bogus boisterous bolster boorish braid brash brass brazen breach brisk brisket brittle broach brook buoyant burgeon burnish bust cabal cadge calipers calumniate calumny candid canvass capricious castigate castigation casual catalyst caustic censure census centurion chary chastened chastisement chauvinist chisel churl cite clamor cleanse clingto clot cloture coalescing coax coddle coerce coeval cogent cogitate cognition cognizant coherent colander collaborate collusion combustion commemorate commend commendable commingle commuter complacently complaisance comply compound comprise compunction conceal conceit conciliatory concord concur condense condone congeal conjoin connoisseur connotation consent consequential consolation console conspicuous consternation constrict consume contemn contentious contiguous contrite contumacious conundrum conviction convoke convoluted cord cordial cordon corporeal correlate corroboration countenance counterfeit countervail covert covetous cower craven crease credulity credulous crush cryptic cumbersome curmudgeon curriculum cursory curtail cynic dart daunt dawdler dearth debacle decorous decorum decree decry defer deference deferential defiance deflect defy degrade delineate deluge demagogue demur denigrate denouement denounce dent deplete deposition deprave deprecate dereliction derision derivative derivative derogatory descry desiccant desiccate desuetude desultory detach deter detraction detumescence deviance dexterity dexterous diaphanous diatribe dictate diffidence diffident dilate dilatory disabuse disallow discern discomfit discomfit disconcert discountenance discourse discredit disdain disencumber disheveled disingenuous disinter dislodge dismal disparate dispassionate dissemble disseminate dissent dissipation dissolution distinct distorted distraught distress divergence diverse divestiture divulge doggerel dogmatic dogmatism dolt dormant dote drone drowsiness dubious dud dulcet dupe duplicity duress dwarf dynamo earthenware ebullience ebullient ecumenical edacious eddy effete efficacy effluvia effrontery egress elaborate elate elation electorate elegy elicit eloquence emaciate embellish embezzle emergence emote empirical encapsulate encomium encumbrance endearing endemic endemic endorse enduring enervate engender engrave engrossing engulf enigma enmity enormity enormousness entangle entreat enzyme epicure epicurean epistle epithet epitome equable equanimity equilibrium equipoise equivocal equivocate eradicate erasure erode erratic erudite escalate esoteric espouse eulogy euphoria euthanasia evaluating evaporate evince evoke evolve excoriate excoriation exculpate exculpate exert exertion exhaustive exigency exonerate exoneration exorbitant expatiate expedient expiation exploit expostulate expurgate exscind exsert extant extensive extenuate extinct extirpate extol extort extralegal extricable extrovert exuberance facetious facile facilitate fallacious fallacy fatuous faucet fawn feckless feckless fecund feint felicitous felon ferment ferocity ferret fertile fertilize fervid fervid fervor fetter feud fidelity fidget figurehead finesse finical finicky finite fission fixate flamboyant flammable flaunting flaw flax fledged fleet fleeting flexibility flinch florid floridness flout fluster foible foil foment foppish forbear forbearance ford forestall forfeit forge forgery forswear fortify fortuitous foster fragile fragrant franchise frantic frenetic fret friction fringe froward frugal fulminate fulmination fulsome gainsay gambol garment garner garrulity garrulous gaucherie germane gist glean glib gloatover glut gnaw goad gossamer gouge grace grave gregarious grievance grievous grimace grind grooves grovel guile guileless gull gullible gust hack hallow hamper hapless harangue harbinger harrow harsh haughty haven heed heinous heresy hermetic heterogeneous hew hirsute hoax hoipolloi hollow holster hone hoodwink hospitable hubris hurdle husk hypocrisy iconoclast iconoclastic idiosyncrasy idolatrous idolatry idyll ignoble ignominious illicit illusory imbroglio immaculate immerse imminent immutable impair impaired impassive impecunious impede impediment impending imperative imperious imperviousness impermeable imperturbable impervious imperviousness impetuous impiety implacable implausibility implicate implicit implosion imply importune imprecation impromptu impudence impudent impugned impute inadvertent inane inasmuch incense incessant inchoate incise incite inclined incoherently incongruous incorrigibility incredulous inculcate incumbents incursion indefatigabilit indelible indelicate indigence indigenous indistinct indolence indomitable indulge indulgent ineffable ineluctable inept infertile inflame inflammatory infuriate infuse ingenuous ingest inherent inhibit inimical inimitable innocuous inscrutable insensible insinuate insipid insouciant insularity insurrection interdict interim intersperse intervene intractable intransigence intransigent intrepid introspection inundate inured invective inveigh inveterate involute irascible irate ire irksome irrelevant irresolute irrevocable itinerary itinerate jabber jeopardize jibe jocular judicious knit labyrinthine lachrymose lackluster laconic lag lament lassitude latent laudatory lavish leakage legacy libel liberality libertine lien limn limp lithe loll loquacious lubricant lubricate lubricious lucubrate luculent lugubrious lull luminary lustrous macabre machination maladroit malapropism malevolence malign malinger malleable manacle martial massacre matriculation mature maudlin maverick mellifluous mendacious mendacity mendicant mercurial meretricious mesmerize meticulous mettle mettlesome middling minatory mince misanthrope mischievous miser misogynist missile mitigate moderation mollify molt morbid morose mortuary multifarious mundane myriad nadir nascent nebulous negligent neophyte nexus nibble nice noisome nonchalant nonplused nostrum notion noxious nullify numb numbness obdurate obfuscate oblivious obloquy obsequious obsolete obstreperous obtain obtrusive obviate occluded occult odious odium odor officious onerous opprobrious ossify ostensible ostentation ostentatious ostracism ostrich outset overhaul overweening overwhelm paean palate palatial palliate palliate palpability palpitate panegyric paradigm parenthesis pariah parsimonious partisan patron paucity peccadillo pedantic pedestrian pellucid penchant penitent penury peregrination peremptory perennial perfidious perfidy perfunctory perilous peripatetic perish perjury permeate pernicious perpetrate persevere personable perspicacity pertain pest petrified petrify petrous petulant philistine phlegmatic picaresque pied pinch pious piquant pique pitfall pith pivotal placate plaintive plaque platitude plea plead plethora pliant plod pluck plumb plummet plunge poignant poise polemical ponderous portent poseur posture poverty pragmatic precarious precept precepts precipitate preclude precursory predilection predominate preempt premature preponderance presage preternatural prevalent prevaricate prim pristine probity proclivity procrastination prodigal prodigious profane profligate profundity proliferate prolix prone propagation propinquity propitiate propitiatory propitious prosaic proscribe protracted provident provisional provoke prudence prudish prune pry pugnacious punch punctilious pundit pungency purvey pusillanimous pyre quack quaff quail qualm quell quibble quiescent quirk quixotic quotidian rabble raconteur radiant raffish railat ramify rancorous rant rapacious rarefy reactionary rebuff recalcitrant recant recast recidivism reciprocity recitals recluse recompense reconcile recondite recourse recreancy recuperate redeem redemptive redoubtable refine refractory refulgent regale regicide reiterate rejuvenation relapse relinquish reluctant remonstrate render renovate renowned rent repast repineat reproach reprobate repudiate repulsive requite resigned resilience resolve resortto restive resurrect resuscitation retard reticent revere rift rivet rollcall rope rotund rubric ruffian sagacious salacious salient salubrious salutary sanctimony sanction sanguine sanity sap sate satiate saturnine savant savor sawdust scabbard scent scribble scurvy seal secular sedulous seminal sententious sequence serrated serration servile severance shaft shallow shard sheath shove shrewd shrill shun shunt sidestep sinuous skiff skit slack slake slate sluggard soar sober sobriety sodden soggy solvent somatic soot sophisticated sophistry sophomoric sordid spear specious splenetic splice sponge spurious spurn squalid squander stanch steeply stentorian stickler stigma stigmatize sting stingy stint stipulate stolid strands stray streak striated stride strut stygian stymie subdue sublime submerge suborn subpoena subsume succor suffice sullied summarily sumptuous sundry supercilious superfluous superimpose supersede supine suppliant supplicate suppress surfeit susceptibility sustain sycophant synopsis taciturn talon tamp tamper tangential tarnished taunt taut tautology tawdry tease tedious teetotal temerity temperance temperate tenacity tenuous terse thrift timid timorous tolerable tonic topple torment torpid tortuous tout touting toy tractable transgress transient transitory trenchant trend trepidation trifling trite truculence trudge turbid turbulence turgid turmoil turpitude tyro ulterior umbrage uncouth underbid undermine undulate unencumbered unfeigned unscathed untoward upbraid urbane vacillation vagary vain valiant valorous vanquish vapor veer venal veneer veneration veracity verisimilitude veritable verve vex vigilance vigilant vigorous vilify vindictive virago visceral vitiate vituperate vivacious volatile volubility voluble voluminous waft wag wage warmonger warp warrant wary weave weigh welter wend whimsical wince woo yarn
Assignment 4/sampleGreText.txt
I abhor tests. They make me sick to my abdomen. So I must adhere to my study schedule. I hate tests.