You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by th...@apache.org on 2019/08/07 20:52:40 UTC
[opennlp-sandbox] branch master updated: Improve encode labels (#37)
This is an automated email from the ASF dual-hosted git repository.
thygesen 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 4fb494f Improve encode labels (#37)
4fb494f is described below
commit 4fb494f453e8a07258d6de2b2cd7ee14942ba513
Author: Peter Thygesen <th...@users.noreply.github.com>
AuthorDate: Wed Aug 7 22:52:36 2019 +0200
Improve encode labels (#37)
---
tf-ner-poc/src/main/python/namefinder/namefinder.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/tf-ner-poc/src/main/python/namefinder/namefinder.py b/tf-ner-poc/src/main/python/namefinder/namefinder.py
index 8cd1503..f180f2b 100644
--- a/tf-ner-poc/src/main/python/namefinder/namefinder.py
+++ b/tf-ner-poc/src/main/python/namefinder/namefinder.py
@@ -121,11 +121,7 @@ class NameFinder:
return sentences, labels, chars_set
def encode_labels(self, labels):
- label_ids = []
- for label in labels:
- label_ids.append(self.label_dict[label])
-
- return label_ids
+ return list(map(lambda l: self.label_dict[l], labels))
def mini_batch(self, char_dict, sentences, labels, batch_size, batch_index):
begin = batch_size * batch_index