Commit 42b61795 authored by Sylvain Hatier's avatar Sylvain Hatier Committed by Arnaud Bey
Browse files

WIP stats bigram letter (& ctype_alnum)

parent b58f7573
......@@ -28,7 +28,7 @@ class LetterManager
{
$string2print="Lettre Language= ".$language->getValue()."\n";
foreach ($letters as $letterValue) {
if (ctype_alpha($letterValue)) {
if (ctype_alnum($letterValue)) {
$letter = new Letter();
$letter->setLanguage($language);
$letter->setValue($letterValue);
......
......@@ -27,7 +27,9 @@ class GenerateGridCommand extends ContainerAwareCommand
$languageName = $input->getArgument('languageName');
$threshold = $input->getArgument('threshold');
$totalFormCount = 0;
$totalFormCountAll = 0;
$keptGrid = 0;
$allGrid = 0;
while ($keptGrid < $number) {
$language = $em->getRepository('LexiconBundle:Language')->findOneByValue($languageName);
......@@ -36,6 +38,7 @@ class GenerateGridCommand extends ContainerAwareCommand
$timeEnd = microtime(true);
$executionTime = round($timeEnd - $timeStart, 2);
$formCount = $grid->getFoundableForms()? count($grid->getFoundableForms()) : 0;
$totalFormCountAll += $formCount;
if ($threshold && $formCount < $threshold) {
$output->writeln('<comment>A grid has been generated but does not contains enough forms ('.$formCount.'). (generated in '.$executionTime.' sec.)</comment>');
......@@ -57,9 +60,13 @@ class GenerateGridCommand extends ContainerAwareCommand
$totalFormCount += $formCount;
}
$em->clear();
$allGrid++;
}
$average = round($totalFormCount / $keptGrid);
$averageAll = round($totalFormCountAll / $allGrid);
$output->writeln('<info>Done ! (average form count: '.$average.')</info>');
$output->writeln('<info>Done ! (average form count for all grids: '.$averageAll.')</info>');
}
}
Supports Markdown
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