summaryrefslogtreecommitdiff
path: root/src/runtime/java/org
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2016-05-25 12:39:51 +0000
committerkrasimir <krasimir@chalmers.se>2016-05-25 12:39:51 +0000
commit69433b966082edeb5e9f9b86c14a31265a95f31d (patch)
treeb680da1c92012e84a01a7ee1fbdd68056b15a5eb /src/runtime/java/org
parent13f9a42ae526e74acbcea7f3d08def69c9f6b583 (diff)
the Java API now also has access to the token's category while doing completion
Diffstat (limited to 'src/runtime/java/org')
-rw-r--r--src/runtime/java/org/grammaticalframework/pgf/TokenProb.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/runtime/java/org/grammaticalframework/pgf/TokenProb.java b/src/runtime/java/org/grammaticalframework/pgf/TokenProb.java
index 3e0c4c62c..2c4ce4447 100644
--- a/src/runtime/java/org/grammaticalframework/pgf/TokenProb.java
+++ b/src/runtime/java/org/grammaticalframework/pgf/TokenProb.java
@@ -3,11 +3,18 @@ package org.grammaticalframework.pgf;
/** Simply a pair of an expression and a probability value. */
public class TokenProb {
private String tok;
+ private String cat;
private double prob;
- public TokenProb(String tok, double prob) {
- this.tok = tok;
+ public TokenProb(double prob, String tok, String cat) {
this.prob = prob;
+ this.tok = tok;
+ this.cat = cat;
+ }
+
+ /** Returns the negative logarithmic probability. */
+ public double getProb() {
+ return prob;
}
/** Returns the token. */
@@ -15,8 +22,8 @@ public class TokenProb {
return tok;
}
- /** Returns the negative logarithmic probability. */
- public double getProb() {
- return prob;
+ /** Returns the category from which this word was predicted. */
+ public String getCategory() {
+ return cat;
}
}