hu.birot.OTKit.otBuildingBlocks
Class Candidate

java.lang.Object
  extended by hu.birot.OTKit.otBuildingBlocks.Candidate

public class Candidate
extends java.lang.Object

Represents a candidate in the candidate set.

By default, a candidate is a pair of an underlying form and of a surface form. A (nick)name can also be associated with the candidate, but this name is optional. The name can, for instance, summarize the complex structure of the surface form.

In theory, the underlying form is necessary, but in practice you do not always want to bother about it. So the underlying form is made optional when constructing a Candidate: in such a case, an empty form will serve as the underlying form.

Additionally, the surface form can be replaced by a Vector of Forms or by a HashMap mapping from Strings to Forms. The Vector of Forms Candidate.chain can be used for instance in OT-CC; whereas the HashMap<String, Form> Candidate.multi is intended for use in multiple layered models. An example for such a multiple layered model is Paul Boersma's approach, whose OTKit implementation could use as many hash keys as "morpheme", "underlying form", "surface form", "auditory form" and "articulatory form".


Field Summary
static java.lang.String ArtF
          String "articulatory form" used as the key of the articulatory form in the HashMap of a multilayered candidate.
static java.lang.String AudF
          String "auditory form" used as the key of the auditory form in the HashMap of a multilayered candidate.
 java.util.Vector<Form> chain
          List of Forms, if optimization is performed on lists of forms, such as in OT-CC.
static java.lang.String MorF
          String "morphology" used as the key of the morphological form in the HashMap of a multilayered candidate.
 java.util.HashMap<java.lang.String,Form> multi
          A map from the names of the levels of representation (such as the strings "underlying", "surface", "phonological", "phonetic" or "articulatory") to the corresponding forms.
 java.lang.String name
           
 Form sf
           
static java.lang.String SF
          String "surface form" used as the key of the surface form in the HashMap of a multilayered candidate.
 Form uf
           
static java.lang.String UF
          String "underlying form" used as the key of the underlying form in the HashMap of a multilayered candidate.
 
Constructor Summary
Candidate(Form surfaceform)
          This constructor defines a new candidate, with the surface surfaceform, and an empty underlying form.
Candidate(Form underlyingform, Form surfaceform)
          This constructor defines a new candidate with explicitly giving it an underlying form and a surface form.
Candidate(java.util.HashMap<java.lang.String,Form> form_per_level)
          Construct a Candidate by specifying the HashMap describing the different levels of representations.
Candidate(java.lang.String sform)
          This constructor defines a new candidate, with a surface form containing the string sform, and an empty underlying form.
Candidate(java.lang.String n, Form underlyingform, Form surfaceform)
          This constructor defines a new candidate with explicitly giving it a name, an underlying form and a surface form.
Candidate(java.lang.String name, java.util.HashMap<java.lang.String,Form> form_per_level)
          Construct a Candidate by specifying the HashMap describing the different levels of representations.
Candidate(java.lang.String uform, java.lang.String sform)
          This constructor defines a new candidate.
Candidate(java.lang.String n, java.lang.String uform, java.lang.String sform)
          This constructor defines a new candidate.
Candidate(java.lang.String name, java.util.Vector<Form> chain_of_Forms)
          Construct a Candidate by specifying a chain of forms.
Candidate(java.util.Vector<Form> chain_of_Forms)
          Construct a Candidate by specifying a chain of forms.
 
Method Summary
 Candidate clone()
          Creates a clone of the present candidate: the name, the underlying form, the surface form, the chain and the multi are all (shallowly) cloned separately.
 boolean equals(java.lang.Object o)
          Two Candidates are equal if and only if their underlying forms are equal and their surface forms are equal (given the equal method for Forms).
 int hashCode()
           
 java.lang.String toString()
          This method turns the candidate into a String, which is convenient for printing out.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sf

public Form sf

uf

public Form uf

name

public java.lang.String name

chain

public java.util.Vector<Form> chain
List of Forms, if optimization is performed on lists of forms, such as in OT-CC. In such a case, a Candidate is not an OT candidate any more (an underlying form–surface form pair) anymore, but a series of surface forms with the same underlying form. Unless specified, it is an empty vector.


multi

public java.util.HashMap<java.lang.String,Form> multi
A map from the names of the levels of representation (such as the strings "underlying", "surface", "phonological", "phonetic" or "articulatory") to the corresponding forms. To be used in models operating on several levels of representations, not simply un underlying form and a surface form. Unless defined, it is an empty hash.


UF

public static final java.lang.String UF
String "underlying form" used as the key of the underlying form in the HashMap of a multilayered candidate.

See Also:
Constant Field Values

SF

public static final java.lang.String SF
String "surface form" used as the key of the surface form in the HashMap of a multilayered candidate.

See Also:
Constant Field Values

MorF

public static final java.lang.String MorF
String "morphology" used as the key of the morphological form in the HashMap of a multilayered candidate.

See Also:
Constant Field Values

AudF

public static final java.lang.String AudF
String "auditory form" used as the key of the auditory form in the HashMap of a multilayered candidate.

See Also:
Constant Field Values

ArtF

public static final java.lang.String ArtF
String "articulatory form" used as the key of the articulatory form in the HashMap of a multilayered candidate.

See Also:
Constant Field Values
Constructor Detail

Candidate

public Candidate(java.lang.String n,
                 java.lang.String uform,
                 java.lang.String sform)
This constructor defines a new candidate.

Parameters:
n - A (nick)name of the candidate.
uform - String defining the underlying form.
sform - String defining the surface form.

Candidate

public Candidate(java.lang.String uform,
                 java.lang.String sform)
This constructor defines a new candidate.

Parameters:
uform - String defining the underlying form.
sform - String defining the surface form.

Candidate

public Candidate(java.lang.String sform)
This constructor defines a new candidate, with a surface form containing the string sform, and an empty underlying form.

Parameters:
sform - String defining the surface form.

Candidate

public Candidate(java.lang.String n,
                 Form underlyingform,
                 Form surfaceform)
This constructor defines a new candidate with explicitly giving it a name, an underlying form and a surface form.

Parameters:
n - A (nick)name for the candidate.
underlyingform - The underlying form.
surfaceform - The surface form.

Candidate

public Candidate(Form underlyingform,
                 Form surfaceform)
This constructor defines a new candidate with explicitly giving it an underlying form and a surface form.

Parameters:
underlyingform - The underlying form.
surfaceform - The surface form.

Candidate

public Candidate(Form surfaceform)
This constructor defines a new candidate, with the surface surfaceform, and an empty underlying form.

Parameters:
surfaceform - The surface form.

Candidate

public Candidate(java.util.Vector<Form> chain_of_Forms)
Construct a Candidate by specifying a chain of forms. Note that Candidate.uf is set as the 0th element of the parameter, and Candidate.sf will be the last element of the vector. (Obviously, you may subsequently reset or ignore Candidate.uf and Candidate.sf.)

Parameters:
chain_of_Forms - Vector of Forms that should become Constraint.chain.

Candidate

public Candidate(java.lang.String name,
                 java.util.Vector<Form> chain_of_Forms)
Construct a Candidate by specifying a chain of forms. Note that Candidate.uf is set as the 0th element of the parameter, and Candidate.sf will be the last element of the vector. (Obviously, you may subsequently reset or ignore Candidate.uf and Candidate.sf.)

Parameters:
name - A (nick)name for the candidate.
chain_of_Forms - Vector of Forms that should become Constraint.chain.

Candidate

public Candidate(java.lang.String name,
                 java.util.HashMap<java.lang.String,Form> form_per_level)
Construct a Candidate by specifying the HashMap describing the different levels of representations. Note that Candidate.uf is set as the Form mapped to by the key "underlying" in this hash, and Candidate.sf will be Form mapped to by the key "surface". (Obviously, you may subsequently reset or ignore Candidate.uf and Candidate.sf.)

Parameters:
name - A (nick)name for the candidate.
form_per_level - HashMap that should become Constraint.multi.

Candidate

public Candidate(java.util.HashMap<java.lang.String,Form> form_per_level)
Construct a Candidate by specifying the HashMap describing the different levels of representations. Note that Candidate.uf is set as the Form mapped to by the key "underlying" in this hash, and Candidate.sf will be Form mapped to by the key "surface". (Obviously, you may subsequently reset or ignore Candidate.uf and Candidate.sf.)

Parameters:
form_per_level - HashMap that should become Constraint.multi.
Method Detail

clone

public Candidate clone()

Creates a clone of the present candidate: the name, the underlying form, the surface form, the chain and the multi are all (shallowly) cloned separately.

This method overrides the method java.lang.Object.clone. Note that the return type of the overridden method is Candidate, and not Object.

Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()

This method turns the candidate into a String, which is convenient for printing out. It overrides java.lang.Object.toString.

If the name of the Candidate is not an empty string, then the output of the toString method starts with name + " : ". Then, if the uf is not an empty Form, then it contains uf.toString() + " | ". Finally, the String always contains sf.toString(). Note the importance of the Form.toString() method, which you may wish to override.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the Candidate.

equals

public boolean equals(java.lang.Object o)
Two Candidates are equal if and only if their underlying forms are equal and their surface forms are equal (given the equal method for Forms). If chain or multi is defined, they also must be the same. The names need not be equal, in order to have two candidates be equal!

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object