diff --git a/Features.py b/Features.py index dbf2953..41f83ef 100644 --- a/Features.py +++ b/Features.py @@ -8,6 +8,7 @@ from NLPTreeHelper import containsSpan import sys import hminghkm as minghkm +from pyglog import * class LocalFeatures: def __init__(self, pef, pfe): @@ -98,6 +99,9 @@ def ff_identity(self, info, fWord, eWord, fIndex, eIndex, links, diagValues, cur name = self.ff_identity.func_name if len(links) == 1: link = links[0] + CHECK_GT(len(info['f']), 0, "Length of f sentence is 0.") + CHECK_GT(len(info['e']), 0, "Length of e sentence is 0.") + if info['f'][link[0]] == info['e'][link[1]]: return {name: 1.0} return {name: 0.0} diff --git a/README b/README index 2b505d5..954eead 100644 --- a/README +++ b/README @@ -401,7 +401,7 @@ pages 1500-1511. Franz Josef Och and Hermann Ney. A Systematic Comparison of Various Statistical Alignment Models. Computational Linguistics, Volume 29, Number 1, pages 19-51. March 2003. -Jason Riesa and Daniel Marcu. Hierarchical Seach for Word Alignment. 2010. +Jason Riesa and Daniel Marcu. Hierarchical Search for Word Alignment. 2010. Proceedings of ACL, pages 157-166. Jason Riesa, Ann Irvine, and Daniel Marcu. Feature-Rich Language-Independent diff --git a/nile.py b/nile.py index 7b32f22..d702c7a 100755 --- a/nile.py +++ b/nile.py @@ -644,7 +644,7 @@ def do_training(indices, training_blob, heldout_blob, weights, weights_out, debi # copy the generic Features.py module to a file called # Features_ar_en.py and add your new feature functions # functions to the file. Then, just call nile with flag: - # --features ar_en + # --langpair ar_en # This will cause Nile to load module Features_ar_en.py # instead of the standard Features.py # @@ -655,7 +655,6 @@ def do_training(indices, training_blob, heldout_blob, weights, weights_out, debi Features = __import__("Features_%s" % (FLAGS.langpair)) except: if myRank == 0: - err_msg = "Language pair %s specified; " %(FLAGS.langpair) err_msg += "could not import language-specific features Features_%s.py. " %(FLAGS.langpair) err_msg += "Using standard featureset." LOG(INFO, err_msg)