summaryrefslogtreecommitdiff
path: root/python/pkg/cdec/sa/features.py
diff options
context:
space:
mode:
authorMichael Denkowski <michael.j.denkowski@gmail.com>2013-01-26 21:12:25 -0500
committerMichael Denkowski <michael.j.denkowski@gmail.com>2013-01-26 21:12:25 -0500
commit5e7a99f9ce09a31092e194c06dd51368e18b3aed (patch)
tree4839ba53bdfdc04a23a47688e25812d1f543342a /python/pkg/cdec/sa/features.py
parentab25e1dc737ca49b8ec13a8f48d18ba961d24342 (diff)
Online grammars now diff with incremental suffix array (except lex, TODO)
Diffstat (limited to 'python/pkg/cdec/sa/features.py')
-rw-r--r--python/pkg/cdec/sa/features.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/pkg/cdec/sa/features.py b/python/pkg/cdec/sa/features.py
index cede5304..49064f73 100644
--- a/python/pkg/cdec/sa/features.py
+++ b/python/pkg/cdec/sa/features.py
@@ -21,21 +21,21 @@ def SampleCountF(ctx): # sample c(f)
if not ctx.online:
count = 1 + ctx.fsample_count
else:
- count = 1 + ctx.fsample_count + ctx.online.fcount
+ count = 1 + ctx.fsample_count + ctx.online.fsample_count
return math.log10(count)
def EgivenFCoherent(ctx): # c(e, f) / sample c(f)
if not ctx.online:
prob = ctx.paircount/ctx.fsample_count
else:
- prob = (ctx.paircount + ctx.online.paircount) / (ctx.fsample_count + ctx.online.fcount)
+ prob = (ctx.paircount + ctx.online.paircount) / (ctx.fsample_count + ctx.online.fsample_count)
return -math.log10(prob) if prob > 0 else MAXSCORE
def CoherenceProb(ctx): # c(f) / sample c(f)
if not ctx.online:
prob = ctx.fcount/ctx.fsample_count
else:
- prob = (ctx.fcount + ctx.online.fcount) / (ctx.fsample_count + ctx.online.fcount)
+ prob = (ctx.fcount + ctx.online.fcount) / (ctx.fsample_count + ctx.online.fsample_count)
return -math.log10(prob)
def MaxLexEgivenF(ttable):
@@ -95,7 +95,7 @@ def IsFEGreaterThanZero(ctx):
count = ctx.paircount + ctx.online.paircount
return (ctx.paircount > 0.01)
-def IsSupportedOnline(ctx):
+def IsSupportedOnline(ctx): # Occurs in online data?
if ctx.online:
return (ctx.online.fcount > 0.01)
else: