|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hu.birot.OTKit.otBuildingBlocks.Gen
public class Gen
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.
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 |
---|
public java.lang.String name
Constructor Detail |
---|
public Gen()
Gen
with an empty map. Can be used for instance if you
override the methods yourself.
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))
.
m
- MapForm that contains the mapping from underlying forms to surface forms.MapForm
Method Detail |
---|
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.
uf
- Underlying form, relative to which the method
returns a random candidate.rnd
- A random value defining which form to be returned.
rnd
)
corresponding to the underlying form uf
.MapForm.random(Form, double)
,
MapForm.NoMapping
,
MapForm.RndTooHigh
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.
uf
- Underlying form, relative to which
the method returns the first candidate.
uf
.MapForm.first(Form)
,
MapForm.NoMapping
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
.
c
- Candidate, the successor of which is returned.
c
.MapForm.next(hu.birot.OTKit.dataType.Form, hu.birot.OTKit.dataType.Form)
,
MapForm.NoMoreForm
,
MapForm.NoMapping
,
MapForm.NotInRange
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
.
uf
- Underlying form, relative to which the method
returns all candidates.
MapForm.all(hu.birot.OTKit.dataType.Form)
,
MapForm.InfiniteSet
,
MapForm.NoMapping
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |