Skip to content

Commit

Permalink
Fixed confusing error message regarding featureset loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Riesa committed Jun 10, 2012
1 parent 2a9a237 commit 24f50c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Features.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from NLPTreeHelper import containsSpan
import sys
import hminghkm as minghkm
from pyglog import *

class LocalFeatures:
def __init__(self, pef, pfe):
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions nile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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)
Expand Down

0 comments on commit 24f50c1

Please sign in to comment.