Groups
Conversations
All groups and messages
Send feedback to Google
Help
Training
Sign in
Groups
jane Users
Conversations
About
Zeros versus scripts/mosesRules2Jane.py
16 views
Skip to first unread message
Kenneth Heafield
unread,
Jun 28, 2013, 9:03:23 AM
6/28/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jane-...@googlegroups.com
Apparently Moses phrase table extraction can sometimes produce zero probabilities due to numerical precision issues.
% im [X][X] auf [X] ||| % in [X][X] to [X] ||| 0 0.00521404 0 0.0844765 2.718 ||| 2-2 ||| 12.1811 12.4007
This causes Jane's conversion script to fail:
Traceback (most recent call last):
File "scripts/mosesRules2Jane.py", line 36, in <module>
janeScores.append(str(-math.log(float(s))))
Note that Moses internally with take the log of probabilities then floor them at -100. So I suggest this modification:
for s in scores:
f = float(s)
janeScores.append("-100" if f == 0.0 else str(-math.log(f)))
Jan
unread,
Jul 1, 2013, 3:41:29 AM
7/1/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jane-...@googlegroups.com
Hi Ken,
0 should map to 100 since we are using -log(x) and we should then floor all the scores to 100:
for s in scores:
f = float(s)
f = 100.0 if f == 0.0 else -math.log(f)
f = min(100,f)
janeScores.append(str(f))
It's now fixed in our code base, thanks for pointing that out.
Reply all
Reply to author
Forward
0 new messages