|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectstandup.lexicon.LexemeSet
public class LexemeSet
A LexemeSet
is, appropriately enough, a set of Lexeme
s.
Field Summary | |
---|---|
protected HashSet<Lexeme> |
set
The actual set of Lexeme s. |
Constructor Summary | |
---|---|
LexemeSet()
Constructor method for the creation of a new, empty, LexemeSet . |
|
LexemeSet(Collection<Lexeme> words)
Constructor method for the creation of a new LexemeSet populated
with the given Lexeme s. |
|
LexemeSet(Element e)
Constructor method for the loading of an existing LexemeSet
specified within an XML file. |
Method Summary | |
---|---|
boolean |
add(Lexeme l)
Tries to add the given Lexeme to this LexemeSet . |
boolean |
add(LexemeSet ls)
Tries to add the Lexeme s contained within the given
LexemeSet to this LexemeSet , effectively making this
LexemeSet the union of the two. |
(package private) void |
addLexemesFromXML(Element element)
Adds all Lexeme s specified within the given XML Element
to this LexemeSet . |
boolean |
contains(Lexeme lx)
Returns true if this LexemeSet contains the given
Lexeme , and false otherwise. |
LexemeSet |
duplicate()
Returns a duplicate of this LexemeSet . |
boolean |
equals(Object obj)
|
int |
getLexemeCount()
Returns the number of Lexeme s in this object. |
HashSet<Lexeme> |
getLexemes()
Returns the Lexeme s in this object as a HashSet<Lexeme> . |
Iterator<Lexeme> |
getLexemesIterator()
Returns the Lexeme s in this object as an
Iterator<Lexeme> . |
Lexeme |
getRandom()
Returns a randomly selected Lexeme from this LexemeSet . |
Hashtable<String,LexemeSet> |
getSpelledClusters()
Creates a Hashtable that clusters the Lexeme s contained
in this LexemeSet by orthography. |
LexemeSet |
getSpelledLexemes(WordForm w)
Returns a LexemeSet that is a subset of this LexemeSet
containing Lexeme s whose form is the given WordForm . |
LexemeSet |
getSpelledLexemes(WordSequence ws)
Returns a LexemeSet that is a subset of this LexemeSet
containing Lexeme s whose spelling is the same as the given
WordSequence . |
int |
hashCode()
|
boolean |
isEmpty()
Returns true if this LexemeSet contains no Lexeme s,
and false otherwise. |
boolean |
remove(Lexeme l)
Tries to remove the given Lexeme from this LexemeSet . |
boolean |
remove(LexemeSet ls)
Tries to remove the Lexeme s contained within the given
LexemeSet from this LexemeSet . |
Lexeme |
removeRandom()
Returns a randomly removed Lexeme from this LexemeSet . |
String |
toString()
|
void |
writeXML(Writer out,
String indent)
Implementation of XMLizable.writeXML(Writer, String) . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected HashSet<Lexeme> set
Lexeme
s. It should only ever be
accessed/updated using the provided accessor functions (add, remove,
etc.).
Constructor Detail |
---|
public LexemeSet()
LexemeSet
.
public LexemeSet(Collection<Lexeme> words)
LexemeSet
populated
with the given Lexeme
s.
words
- the Lexeme
s to be added to the new LexemeSet
public LexemeSet(Element e)
LexemeSet
specified within an XML file.
e
- the XML Element
containing the LexemeSet
details. It should have been the output of
writeXML(Writer, String)
.Method Detail |
---|
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
public LexemeSet duplicate()
LexemeSet
.
public boolean add(Lexeme l)
Lexeme
to this LexemeSet
.
l
- the Lexeme
to be added to this object
true
if the addition was successful, or false
if
the Lexeme
already exists in this objectpublic boolean add(LexemeSet ls)
Lexeme
s contained within the given
LexemeSet
to this LexemeSet
, effectively making this
LexemeSet
the union of the two.
ls
- the LexemeSet
to be added to this object
true
if this object changed as a result, or false
if all the Lexeme
s in the given LexemeSet
already exist in this objectpublic boolean remove(Lexeme l)
Lexeme
from this LexemeSet
.
l
- the Lexeme
to be removed from this object
true
if the removal was succesful, or false
if
the Lexeme
did not previously exist in this objectpublic boolean remove(LexemeSet ls)
Lexeme
s contained within the given
LexemeSet
from this LexemeSet
.
ls
- the LexemeSet
to be removed from this object
true
if this object changed as a result, or false
if all the Lexeme
s in the given LexemeSet
did
not previously exist in this objectpublic Lexeme getRandom()
Lexeme
from this LexemeSet
.
Does not modify this object.
Lexeme
public Lexeme removeRandom()
Lexeme
from this LexemeSet
.
Note that it modifies this object.
Lexeme
public boolean contains(Lexeme lx)
true
if this LexemeSet
contains the given
Lexeme
, and false
otherwise.
public boolean isEmpty()
true
if this LexemeSet
contains no Lexeme
s,
and false
otherwise.
public Iterator<Lexeme> getLexemesIterator()
Lexeme
s in this object as an
Iterator<Lexeme>
.
Iterator
of the Collection
of
Lexeme
s.public HashSet<Lexeme> getLexemes()
Lexeme
s in this object as a HashSet<Lexeme>
.
public int getLexemeCount()
Lexeme
s in this object.
public Hashtable<String,LexemeSet> getSpelledClusters()
Hashtable
that clusters the Lexeme
s contained
in this LexemeSet
by orthography.
A Hashtable
key k is a String
s of orthographic
spelling, and the value v is a LexemeSet
s of all
Lexeme
s contained in this LexemeSet
that are spelt k.
public LexemeSet getSpelledLexemes(WordForm w)
LexemeSet
that is a subset of this LexemeSet
containing Lexeme
s whose form is the given WordForm
.
w
-
LexemeSet
, possibly empty, or null
if
w
is null
.public LexemeSet getSpelledLexemes(WordSequence ws)
LexemeSet
that is a subset of this LexemeSet
containing Lexeme
s whose spelling is the same as the given
WordSequence
.
ws
-
LexemeSet
, possibly empty, or null
if
ws
is null
.public void writeXML(Writer out, String indent) throws IOException, XMLException
XMLizable.writeXML(Writer, String)
.
writeXML
in interface XMLizable
out
- The output stream for the XML file, which is assumed to be
already opened and writable.indent
- A string to be prepended before every line written by this
method. If passed appropriate white space, e.g.
XMLUtils.xmlIndent
, it can be used to control
indentation.
IOException
XMLException
void addLexemesFromXML(Element element)
Lexeme
s specified within the given XML Element
to this LexemeSet
.
element
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |