Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathieu Loiseau
MagicWord
Commits
9c355e20
Commit
9c355e20
authored
May 28, 2021
by
Arnaud Bey
Browse files
fix division by 0
parent
87a50541
Changes
2
Hide whitespace changes
Inline
Side-by-side
application/src/MagicWordBundle/Command/GenerateGridCommand.php
View file @
9c355e20
...
...
@@ -128,8 +128,8 @@ class GenerateGridCommand extends ContainerAwareCommand
$output
->
writeln
(
'Worst grid : <error>'
.
$worst
.
'</error>'
);
$output
->
writeln
(
'<info>###########################################################</info>'
);
$file
=
"data/import-"
.
$idLexicon
.
".csv"
;
$output
=
$minBigram
.
";"
.
$number
.
";"
.
$averageAll
.
";"
.
$averageLemmas
.
";"
.
$distinctLemmas
.
";"
.
$averageComboCounts
.
";"
.
$averageCombos
.
"
\n
"
;
file_put_contents
(
$file
,
$output
,
FILE_APPEND
);
//
$file = "data/import-".$idLexicon.".csv";
//
$output = $minBigram.";".$number.";".$averageAll.";".$averageLemmas.";".$distinctLemmas.";".$averageComboCounts.";".$averageCombos."\n";
//
file_put_contents($file, $output, FILE_APPEND);
}
}
application/src/MagicWordBundle/Manager/GridManager.php
View file @
9c355e20
...
...
@@ -188,7 +188,7 @@ class GridManager
foreach
(
$combos
as
$combo
)
{
$totalCombo
+=
count
(
$combo
[
"words"
]);
}
$average
=
$totalCombo
/
$length
;
$average
=
(
$length
>
0
)
?
$totalCombo
/
$length
:
0
;
return
$average
;
}
...
...
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