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 2019/08/07 14:18:19 UTC

[opennlp-sandbox] branch master updated: fixing writing order of label, token, chars when written to file

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 1aea823  fixing writing order of label, token, chars when written to file
1aea823 is described below

commit 1aea823071f944a94c097c49ad6441f52d621d3d
Author: Peter Thygesen <th...@apache.org>
AuthorDate: Wed Aug 7 15:57:09 2019 +0200

    fixing writing order of label, token, chars when written to file
---
 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 ad2a0f0..e7fe436 100644
--- a/tf-ner-poc/src/main/python/namefinder/namefinder.py
+++ b/tf-ner-poc/src/main/python/namefinder/namefinder.py
@@ -328,7 +328,7 @@ def get_chunks(seq, tags):
 
 def write_mapping(tags, output_filename):
     with open(output_filename, 'w', encoding='utf-8') as f:
-        for i, tag in enumerate(tags):
+        for (tag, i) in sorted(tags.items(), key=lambda x: x[1]):
             f.write('{}\n'.format(tag))