You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2018/10/10 13:18:46 UTC

[opennlp-sandbox] 01/01: Compute ntags based on label dict size

This is an automated email from the ASF dual-hosted git repository.

joern pushed a commit to branch ntags_fix
in repository https://gitbox.apache.org/repos/asf/opennlp-sandbox.git

commit 9f03420f1071133ad6fd897331b0001e98b6dafc
Author: Jörn Kottmann <jo...@apache.org>
AuthorDate: Wed Oct 10 15:18:25 2018 +0200

    Compute ntags based on label dict size
---
 tf-ner-poc/src/main/python/namefinder/namefinder.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tf-ner-poc/src/main/python/namefinder/namefinder.py b/tf-ner-poc/src/main/python/namefinder/namefinder.py
index 8ad2335..00560ac 100644
--- a/tf-ner-poc/src/main/python/namefinder/namefinder.py
+++ b/tf-ner-poc/src/main/python/namefinder/namefinder.py
@@ -261,7 +261,7 @@ class NameFinder:
 
             labels = tf.placeholder(tf.int32, shape=[None, None], name="labels")
 
-        ntags = 7; # TODO: Compute this and not hard code
+        ntags = len(self.label_dict)
 
         W = tf.get_variable("W", shape=[2*hidden_size, ntags], dtype=tf.float32)
         b = tf.get_variable("b", shape=[ntags], dtype=tf.float32, initializer=tf.zeros_initializer())