bugfix in moses phrase table conversion
problem was with handling lines starting with '['
diff --git a/scripts/support/phrase2hiero.py b/scripts/support/phrase2hiero.py
index fd86f02..13ed094 100755
--- a/scripts/support/phrase2hiero.py
+++ b/scripts/support/phrase2hiero.py
@@ -41,19 +41,16 @@
except ValueError:
return value
-for line in sys.stdin:
- moses = False
+for lineno,line in enumerate(sys.stdin):
# Moses phrase tables do not have a left-hand side symbol, add that
- if not line.startswith('['):
- line = '[X] ||| ' + line
- moses = True
+ line = '[X] ||| ' + line
# Get all the fields
tokens = line.split(r' ||| ')
# take the -log() of each input token
- if moses and len(tokens) >= 4:
+ if len(tokens) >= 4:
tokens[3] = ' '.join(map(maybelog, tokens[3].split(' ')))
print ' ||| '.join(tokens),