hu.birot.OTKit.otBuildingBlocks
Class Gen

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

public class Gen
extends java.lang.Object

Realizes GEN, the OT generator function. For each underlying form (Form uf), it defines a set of candidates (with uf == c.uf for each element c of this set).

There are two ways of defining a GEN function. Most often you will simply define a new Gen by using the constructor Gen() and you override its methods (at least those that you need).

The second way is to define first a MapForm m that encodes the mapping from an underlying form uf to the corresponding surface forms. Then, you use the constructor Gen(m). The difference between m and Gen(m) is that the former maps from (underlying) Forms to (surface) Forms, whereas the latter maps from (underlying) Forms to Candidates. The former is an intermediate step to get to the latter, but only objects of type Gen are used everywhere else.

See Also:
MapForm, MapFormExamples

Field Summary
 java.lang.String name
          An optional nickname of the candidate set.
 
Constructor Summary
Gen()
          Construct a new Gen with an empty map.
Gen(MapForm m)
          Construct a new Gen employing the MapForm m.
 
Method Summary
 java.util.Vector<Candidate> allCandidates(Form uf)
          Returns a vector of all the candidates constructed by the underlying form uf and a surface form to which the underlying form is mapped to.
 Candidate firstCandidate(Form uf)
          Returns the first candidate in the candidate set corresponding to underlying form uf.
 Candidate nextCandidate(Candidate c)
          Returns the next candidate in the candidate set corresponding to underlying form c.uf, the one following candidate c.
 Candidate randomCandidate(Form uf, double rnd)
          Returns a random candidate in the candidate set corresponding to the underlying form uf.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name
An optional nickname of the candidate set. E.g., the underlying form.

Constructor Detail

Gen

public Gen()
Construct a new Gen with an empty map. Can be used for instance if you override the methods yourself.


Gen

public Gen(MapForm m)

Construct a new Gen employing the MapForm m.

The candidate set corresponding to an underlying Form uf is the set of candidates c such that c.uf == uf and c.sf is the set to which m maps uf. So for instance, Gen.firstCandidate(uf) is Candidate(uf, m.first(uf)).

Parameters:
m - MapForm that contains the mapping from underlying forms to surface forms.
See Also:
MapForm
Method Detail

randomCandidate

public Candidate randomCandidate(Form uf,
                                 double rnd)

Returns a random candidate in the candidate set corresponding to the underlying form uf.

If uf is not in the domain of Gen.map, then Candidate(uf, MapForm.NoMapping) is returned. If rnd is too high (greater than 1), then Candidate(uf, MapForm.rndTooHigh) is returned. If rnd is less than 0, then the result is the same as if rnd were equal to 0.

Parameters:
uf - Underlying form, relative to which the method returns a random candidate.
rnd - A random value defining which form to be returned.
Returns:
A random candidate (determined by rnd) corresponding to the underlying form uf.
See Also:
MapForm.random(Form, double), MapForm.NoMapping, MapForm.RndTooHigh

firstCandidate

public Candidate firstCandidate(Form uf)

Returns the first candidate in the candidate set corresponding to underlying form uf.

If uf is not in the domain of Gen.map, then Candidate(uf, MapForm.NoMapping) is returned.

Parameters:
uf - Underlying form, relative to which the method returns the first candidate.
Returns:
The first candidate corresponding to underlying form uf.
See Also:
MapForm.first(Form), MapForm.NoMapping

nextCandidate

public Candidate nextCandidate(Candidate c)

Returns the next candidate in the candidate set corresponding to underlying form c.uf, the one following candidate c.

If c is the last candidate in the candidate set, then it returns a Candidate whose surface form contains is MapForm.NoMoreForm ("ERROR: no more forms."). Theoretically, you can also be returned Candidate(c.uf, MapForm.NotInRange), if c.uf does not map to c.sf; or Candidate(c.uf, MapForm.NoMapping), if c.uf is even not in the domain of Gen.map.

Parameters:
c - Candidate, the successor of which is returned.
Returns:
The candidate in the candidate set that follows candidate c.
See Also:
MapForm.next(hu.birot.OTKit.dataType.Form, hu.birot.OTKit.dataType.Form), MapForm.NoMoreForm, MapForm.NoMapping, MapForm.NotInRange

allCandidates

public java.util.Vector<Candidate> allCandidates(Form uf)

Returns a vector of all the candidates constructed by the underlying form uf and a surface form to which the underlying form is mapped to.

If the set is infinite, then the vector returned contains the single candidate Candidate(uf, MapForm.InfiniteSet). Similarly, a vector with the single Candidate(uf, MapForm.NoMapping) is returned, if the map realizing Gen has no mapping for uf.

Parameters:
uf - Underlying form, relative to which the method returns all candidates.
Returns:
A vector of all candidates in the candidate set (those that are mapped from the underlying form).
See Also:
MapForm.all(hu.birot.OTKit.dataType.Form), MapForm.InfiniteSet, MapForm.NoMapping