Commit 9c355e20 authored by Arnaud Bey's avatar Arnaud Bey
Browse files

fix division by 0

parent 87a50541
......@@ -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);
}
}
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment