mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
added fullFormLexicon in Java
This commit is contained in:
@@ -775,7 +775,7 @@ word form with its possible analyses:
|
||||
Prelude PGF2> mapM_ print [(form,lemma,analysis,prob) | (form,analyses) <- fullFormLexicon eng, (lemma,analysis,prob) <- analyses]
|
||||
</pre>
|
||||
<pre class="java">
|
||||
for (FullFormEntry entry in eng.fullFormLexicon()) { ///// TODO
|
||||
for (FullFormEntry entry : eng.fullFormLexicon()) {
|
||||
for (MorphoAnalysis analysis : entry.getAnalyses()) {
|
||||
System.out.println(entry.getForm()+" "+analysis.getProb()+" "+analysis.getLemma()+" "+analysis.getField());
|
||||
}
|
||||
|
||||
@@ -1107,8 +1107,11 @@ Java_org_grammaticalframework_pgf_Lexicon_lookupWordPrefix
|
||||
GuPool* pool = gu_new_pool();
|
||||
GuExn* err = gu_new_exn(pool);
|
||||
|
||||
GuEnum* en = pgf_lookup_word_prefix(get_ref(env, jconcr), j2gu_string(env, prefix, pool),
|
||||
pool, err);
|
||||
GuEnum* en =
|
||||
(prefix == NULL) ? pgf_fullform_lexicon(get_ref(env, jconcr),
|
||||
pool)
|
||||
: pgf_lookup_word_prefix(get_ref(env, jconcr), j2gu_string(env, prefix, pool),
|
||||
pool, err);
|
||||
if (!gu_ok(err)) {
|
||||
if (gu_exn_caught(err, PgfExn)) {
|
||||
GuString msg = (GuString) gu_exn_caught_data(err);
|
||||
|
||||
@@ -70,7 +70,9 @@ public class Concr {
|
||||
public native List<MorphoAnalysis> lookupMorpho(String sentence);
|
||||
|
||||
/** Creates an iterable over the full form lexicon in the grammar */
|
||||
public native Iterable<FullFormEntry> fullFormLexicon();
|
||||
public Iterable<FullFormEntry> fullFormLexicon() {
|
||||
return new Lexicon(this, null);
|
||||
}
|
||||
|
||||
/** Returns an iterable enumerating all words in the lexicon
|
||||
* starting with a given prefix.
|
||||
|
||||
Reference in New Issue
Block a user