Esempio n. 1
0
 function add_less_frequent_words_to_results()
 {
     list($pocas) = array_keys($this->occurences);
     // echo '<p>Buscando: '.$pocas[0].' - ';
     $new = my_array_find($pocas[0], $this->madefrom_text);
     // echo 'Encontrado: '.$new.'</p>';
     if (!empty($new)) {
         $this->resulting_text[] = $new;
         if (($key = array_search($new, $this->madefrom_text)) !== false) {
             unset($this->madefrom_text[$key]);
         }
     }
     # Actualiza Estadisticas
     foreach ($this->occurences as $letra => $occurencias) {
         $this->occurences[$letra] = substr_count(implode('', $this->resulting_text), $letra);
     }
     natsort($this->occurences);
     return $this;
 }
    if ($cuenta == 0) {
        echo '<p style="color:red;">-</p>';
    } else {
        $frequency = round($cuenta * 100 / $total_letters, 1);
        if ($frequency < 1) {
            echo '<p style="color:red;">' . $frequency . '%</p>';
        } else {
            echo '<p>' . $frequency . '%</p>';
        }
    }
}
echo '</td>';
echo '<td valign="top">';
# Creo un Array limpito, con Frecuencia Zero
$made_from = array_unique(mb_str_split($analizertwo));
$new = my_array_find(' ', $made_from);
if (($key = array_search($new, $made_from)) !== false) {
    unset($made_from[$key]);
}
$made_from = array_flip($made_from);
ksort($made_from);
foreach ($made_from as $key => $value) {
    $made_from_as_array[$key] = 0;
}
foreach ($made_from_as_array as $letra => $occurencias) {
    $made_from_as_array[$letra] = substr_count($analizertwo, $letra);
}
natsort($made_from_as_array);
echo '<pre>';
print_r($made_from_as_array);
echo '</pre>';