Hello,

we are a little Spanish ISP and our users used UNWANTED_LANGUAGE_BODY
rules.

We have observed that language of many mails are not identified. We have
done some tests and we think that TextCat is not working well.
For example if the body is in capital letters, include URL's or not
alfanumeric symbols, it doesn't work.

We have modified a little TextCat plugin to exlude words with not
alfanumeric symbols are the match is better. 

We'd like to anwser if this is known or we are doing something wrong.

Thank you.


sub create_lm {
  my ($inputptr, $conf) = @_;
  my %ngram;
  my @sorted;

  # my $non_word_characters = qr/[0-9\s]/;
  for my $word (split(/[0-9\s]+/, ${$_[0]}))
  {
    $word = lc($word);
    dbg("textcat: word: [$word]");
    if ($word =~ /(\W+|_)/)
    {
   
        dbg("textcat: word excluded: [$word]");
    }
    else
    {
        dbg("textcat: word accepted: [$word]");
        $word = "\000" . $word . "\000";
        my $len = length($word);
        my $flen = $len;
        my $i;
        for ($i = 0; $i < $flen; $i++) {
        $len--;
        $ngram{substr($word, $i, 1)}++;
        ($len < 1) ? next : $ngram{substr($word, $i, 2)}++;
        ($len < 2) ? next : $ngram{substr($word, $i, 3)}++;
        ($len < 3) ? next : $ngram{substr($word, $i, 4)}++;
        if ($len > 3) { $ngram{substr($word, $i, 5)}++ };
        }
     }
  }



-- 
___________________________________________

Antonio M. Guirado Puerta
Sistemas  de Información y Comunicaciones
Fundación Integra. http://www.f-integra.org

Teléfono: +34 968 355161
Fax:      +34 968 355131
Correo:   [EMAIL PROTECTED]
___________________________________________
Este mensaje y los posibles documentos adjuntos al mismo son confidenciales y
dirigidos exclusivamente a los destinatarios de los mismos. Si por un error
de transmisión, o equivocación en la dirección de envío, usted ha recibido 
este mensaje y no es el destinatario de la información, por favor, notifíqueselo
al remitente y borre este mensaje, sin usar, informar, distribuir, imprimir, 
copiar
o difundir el mensaje, total o parcialmente, por ningún medio. Gracias.

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente

Reply via email to