Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/marian-regression-tests.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tools/diff-nums.py')
-rwxr-xr-xtools/diff-nums.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/diff-nums.py b/tools/diff-nums.py
index 18b4415..0e527ad 100755
--- a/tools/diff-nums.py
+++ b/tools/diff-nums.py
@@ -16,7 +16,7 @@ NORMALIZE_NUMPY = [
("...) ", "... "),
("..., ", "... "),
("]", " ]"),
- ("[", "[ ")
+ ("[", "[ "),
]
@@ -99,6 +99,7 @@ def read_line(iofile, separator=""):
def process_line(line):
line = REGEX_STRIP_EP.sub("[valid] ", line) # normalize "[valid] Ep. 1 : Up. 30" -> "[valid] 30"
+ line = line.replace("(", "( ").replace(")", " )") # insert space before and after parentheses
line_toks = line.rstrip().replace("[[-", "[[ -").split() # tokenize
nums = [float(s.replace(',', '')) # handle comma as thousands separator
for s in line_toks if is_numeric(s)] # find all numbers