From 69433b966082edeb5e9f9b86c14a31265a95f31d Mon Sep 17 00:00:00 2001 From: krasimir Date: Wed, 25 May 2016 12:39:51 +0000 Subject: the Java API now also has access to the token's category while doing completion --- .../java/org/grammaticalframework/pgf/TokenProb.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/runtime/java/org/grammaticalframework') 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; } } -- cgit v1.2.3