diff options
| author | krasimir <krasimir@chalmers.se> | 2016-05-25 12:39:51 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2016-05-25 12:39:51 +0000 |
| commit | 69433b966082edeb5e9f9b86c14a31265a95f31d (patch) | |
| tree | b680da1c92012e84a01a7ee1fbdd68056b15a5eb /src/runtime/java/org/grammaticalframework | |
| parent | 13f9a42ae526e74acbcea7f3d08def69c9f6b583 (diff) | |
the Java API now also has access to the token's category while doing completion
Diffstat (limited to 'src/runtime/java/org/grammaticalframework')
| -rw-r--r-- | src/runtime/java/org/grammaticalframework/pgf/TokenProb.java | 17 |
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; } } |
