summaryrefslogtreecommitdiff
path: root/python/cdec
diff options
context:
space:
mode:
authorMichael Denkowski <mdenkows@cs.cmu.edu>2014-02-24 23:25:27 -0800
committerMichael Denkowski <mdenkows@cs.cmu.edu>2014-02-24 23:25:27 -0800
commit73bc12bb80316362c3ba0c5a745bfc9591f88c55 (patch)
tree96b69ce6b035c79a54e3fb456cb3c3cce751c161 /python/cdec
parent9cf584746a55fd724de6af39f2fbe7bff1b79643 (diff)
refactoring
Diffstat (limited to 'python/cdec')
-rw-r--r--python/cdec/sa/features.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/python/cdec/sa/features.py b/python/cdec/sa/features.py
index fe3fb2bd..f5cbdb8d 100644
--- a/python/cdec/sa/features.py
+++ b/python/cdec/sa/features.py
@@ -142,17 +142,11 @@ def IsSupportedOnline(ctx): # Occurs in online data?
return False
def CountExceptLM(vocab):
- def CountExceptLM(ctx): # In bitext (inc online data) but NOT mono text
+ def CountExceptLM(ctx): # Word count in bitext (inc online data) but NOT mono text
return sum(1 for e in ctx.ephrase.words if e not in vocab)
return CountExceptLM
def CountExceptLex(ttable):
- def CountExceptLex(ctx):
- count = 0.0
- for e in ctx.ephrase.words:
- if not ttable.contains_e_word(e):
- count += 1
- return count
+ def CountExceptLex(ctx): # Word count in online data but NOT original bitext
+ return sum(1 for e in ctx.ephrase.words if not ttable.contains_e_word(e))
return CountExceptLex
-
-