|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcmsc433.p3.Dictionary
public class Dictionary
The Dictionary is a set of words used to determine
whether a given solution for a grid is legal. The score for a given
word depends on its length and its frequency in the dictionary.
This class is immutable, so it is thread-safe.
| Field Summary | |
|---|---|
int |
MAX_WORD_LEN
|
| Method Summary | |
|---|---|
int |
getScore(int wordLength)
Returns the score that a word would have gotten based only on it's length. |
java.util.Iterator<java.lang.String> |
iterator()
|
static Dictionary |
makeDict(java.lang.String file)
Constructs a dictionary from an input file. |
boolean |
member(java.lang.String word)
Determines whether a given word is in the dictionary. |
int |
score(java.lang.String word)
Computes the score for the given word, based on its length and the distribution of words having that length in the dictionary. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final int MAX_WORD_LEN
| Method Detail |
|---|
public static Dictionary makeDict(java.lang.String file)
file - - contains the words for the dictionary
public boolean member(java.lang.String word)
word -
public int score(java.lang.String word)
word -
public int getScore(int wordLength)
wordLength -
public java.util.Iterator<java.lang.String> iterator()
iterator in interface java.lang.Iterable<java.lang.String>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||