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 199f756 Replace hard coded train, dev and test file names with args
199f756 is described below
commit 199f7563495cfab8bcb0c277469beca9da0eda91
Author: Jörn Kottmann <[email protected]>
AuthorDate: Fri Feb 1 09:57:23 2019 +0100
Replace hard coded train, dev and test file names with args
---
tf-ner-poc/src/main/python/normalizer/normalizer.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tf-ner-poc/src/main/python/normalizer/normalizer.py
b/tf-ner-poc/src/main/python/normalizer/normalizer.py
index 6664cb5..e720cc1 100644
--- a/tf-ner-poc/src/main/python/normalizer/normalizer.py
+++ b/tf-ner-poc/src/main/python/normalizer/normalizer.py
@@ -25,6 +25,7 @@ import tensorflow as tf
import numpy as np
import random
from math import floor
+import sys
def load_data(file):
with open(file, encoding="utf-8") as f:
@@ -195,11 +196,15 @@ def write_mapping(tags, output_filename):
def main():
+ if len(sys.argv) != 4:
+ print("Usage normalizer.py train_file dev_file test_file")
+ return
+
checkpoints_path = "/tmp/model/checkpoints"
- source_train, target_train = load_data("date_train.txt")
- source_dev, target_dev = load_data("date_dev.txt")
- source_test, target_test = load_data("date_test.txt")
+ source_train, target_train = load_data(sys.argv[1])
+ source_dev, target_dev = load_data(sys.argv[2])
+ source_test, target_test = load_data(sys.argv[3])
source_char_dict = encode_chars(source_train + source_dev + source_test)
source_char_dict[chr(0)] = 0