mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-10 05:29:30 -06:00
word completion in the C parser now returns information about the function which generates the token
This commit is contained in:
@@ -731,8 +731,8 @@ Java_org_grammaticalframework_pgf_TokenIterator_fetchTokenProb(JNIEnv* env, jcla
|
||||
return NULL;
|
||||
|
||||
jclass tp_class = (*env)->FindClass(env, "org/grammaticalframework/pgf/TokenProb");
|
||||
jmethodID tp_constrId = (*env)->GetMethodID(env, tp_class, "<init>", "(DLjava/lang/String;Ljava/lang/String;)V");
|
||||
jobject jtp = (*env)->NewObject(env, tp_class, tp_constrId, tp->prob, gu2j_string(env,tp->tok), gu2j_string(env,tp->cat));
|
||||
jmethodID tp_constrId = (*env)->GetMethodID(env, tp_class, "<init>", "(DLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
jobject jtp = (*env)->NewObject(env, tp_class, tp_constrId, (double) tp->prob, gu2j_string(env,tp->tok), gu2j_string(env,tp->cat), gu2j_string(env,tp->fun));
|
||||
|
||||
return jtp;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@ package org.grammaticalframework.pgf;
|
||||
public class TokenProb {
|
||||
private String tok;
|
||||
private String cat;
|
||||
private String fun;
|
||||
private double prob;
|
||||
|
||||
public TokenProb(double prob, String tok, String cat) {
|
||||
public TokenProb(double prob, String tok, String cat, String fun) {
|
||||
this.prob = prob;
|
||||
this.tok = tok;
|
||||
this.cat = cat;
|
||||
this.cat = cat;
|
||||
this.fun = fun;
|
||||
}
|
||||
|
||||
/** Returns the negative logarithmic probability. */
|
||||
@@ -26,4 +28,9 @@ public class TokenProb {
|
||||
public String getCategory() {
|
||||
return cat;
|
||||
}
|
||||
|
||||
/** Returns the function from which this word was predicted. */
|
||||
public String getFunction() {
|
||||
return fun;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user