Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Perepelkin
hppca
Commits
cb62331a
Commit
cb62331a
authored
Jun 04, 2015
by
Vladislav Perepelkin
Browse files
fixed error message bug
parent
f4b28fe3
Changes
2
Hide whitespace changes
Inline
Side-by-side
rules.txt
View file @
cb62331a
5 10 16
5 0.6 0.2 0.2
10 0.
2
0.
6
0.2
10 0.
6
0.
2
0.2
16 0.2 0.2 0.6
scripts/rules_gen.py
View file @
cb62331a
...
...
@@ -25,7 +25,7 @@ def error(message):
print
print
"ERROR"
,
message
print
sys
.
exit
()
sys
.
exit
(
1
)
def
extract_words
(
line
):
return
filter
(
lambda
x
:
x
.
strip
(),
...
...
@@ -100,8 +100,8 @@ while i<len(lines):
for
s0
in
range
(
256
):
sum_prob
=
reduce
(
lambda
x
,
y
:
x
+
y
,
[
rules
[
s0
][
s1
]
for
s1
in
rules
[
s0
]])
if
sum_prob
!=
1
:
error
(
"Normalization fails for state ("
+
s
0
+
"), sum prob is "
+
str
(
sum_prob
))
error
(
"Normalization fails for state ("
+
s
tr
(
s0
)
+
\
"), sum prob is "
+
str
(
sum_prob
))
# generate code
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment