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/12 14:04:40 UTC

[opennlp-sandbox] branch master updated: 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 master
in repository https://gitbox.apache.org/repos/asf/opennlp-sandbox.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f33b3f  Compute ntags based on label dict size
7f33b3f is described below

commit 7f33b3f99c686bc3fe5e92c431362c717c242b9e
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())