Previous: The codepoint-per-earleme model, Up: Advanced input models [Contents][Index]
In the dense input models, the earleme of every Earley set is equal to the ID of that Earley set. But, because of the sparse input models, this is not true in the general case.
For other applications
that want an earleme-to-ID mapping,
the most general method for converting earlemes to Earley set IDs
is to create a ID-to-earleme
array using the
marpa_r_earleme()
method
(see marpa_r_earleme),
and invert it.
The resulting earleme-to-ID array will be sparse.
More precisely, where the function earleme
maps IDs
to earlemes,
the value at index ix
of the array should
be
id
, if earleme(id) = ix
for some id
; and
The Libmarpa interface does not provide a method for earleme-to-ID conversion. The input model is not known at the Libmarpa level, so that an earleme-to-ID method would have to be fully general. A fully general earleme-to-ID method would be costly, an cost which usually would be unnecessary. For these reasons, it’s up to the application to create its own earleme-to-conversion method, if one is needed.
Here are the alternatives:
Previous: The codepoint-per-earleme model, Up: Advanced input models [Contents][Index]