Takiego spamu jeszcze nie miałem…

OK, zosta­łem roz­wa­lony… Spam z gatunku „bawiąc uczy, ucząc — bawi”. Mam wszakże jeden pro­blem: co do jasnej cho­lery mam kupić??? :)


// The "Levenshtein distance" is a measure of the similarity between two strings,

// this algorithm is also refered to as "edit distance". The "Levenshtein distance"

// was named after the russian scientist "Vladimir Levenshtein", who has discovered

// it back in 1965. The smaller the distance between two strings, the closer are

// these strings syntacticaly. The "Levenshtein distance" is computed by

// calculating the minimum number of operations that has to be made to transform

// one string to another one,usualy this operations are: replace,insert or delete a character

// example: we can change the word: "mathematics" to "mathematician" by changing one character

// and by inserting two more characters at the end.(we can replace "s" by "i" and 

// also insert "a" and "n" after that). The total number of operations that was needed in this

// case to change "mathematics" to "mathematician" was 3 operations and since it is

// also the smallest number of operation that can be use to transform one of this strings

// to the other one, that value is also a measure of the "Levenshtein distance" between

// these two strings. 

// There has been many application of the "Levenshtein distance", here is a few of them: 

// Spell Checking, Speech Recognition, Pattern Recognition etc.

// ****************************************************************************

#include "distance.h"

// finds the minimum of tree integers

int _min(int a, int b, int c) {

        return min(min(a, b), c);

}

// allocates a 2D array of integers

int **create_matrix(int Row, int Col) {

        int **array = new int*[Row];

        for(int i = 0; i < Row; ++i) {

                array[i] = new int[Col];

        }

        return array;

}

// deallocates memory

int **delete_matrix(int **array, int Row, int Col) {

        for(int i = 0; i < Row; ++i) {

                delete array[i];

        }

        delete [] array;

        return array;

}

// computes the Levenshtein distance between two strings

// "x" represent the pattern and "y" represent the text

// "m" is the pattern length and "n" is the text length

int LD(const char *x, unsigned int m, const char *y, unsigned int n) {

        // if the length of the second string is zero

        // then the distance between the two strings will

        // be equal to the length of the first string

        // and vis-versa

        // if the length of both strings is equal to zero

        // then the distance between this two strings will

        // simply be zero

        if (n == 0) {

                return m;

        } 

        else if (m == 0) {

                return n;

        }

        // creating a matrix of m+1 rows and n+1 columns

        int **matrix = create_matrix(m + 1, n + 1);

        // initialising the first row of the matrix

        for(unsigned int i = 0; i

Mail przy­był z adresu w dome­nie, która nie ist­nieje, na mój adres ale z jakimś sto­cha­stycz­nym imie­niem i nazwi­skiem… Komuś się chyba bot spa­mowy popin­do­lił :). Anyway, zawsze o kilka lini­jek kodu i — przede wszyst­kim — komen­ta­rza jestem bogatszy!

Kilka słów o CoSTa

Mąż, ojciec i w przyszłosci być może właściciel knajpy, w której będzie serwowana tylko wódka, tylko zimna i tylko na butelki.

Socjal

Jeszcze Ci mało? Śledź nas w sieciach społecznościowych...

2 Komentarzy do “Takiego spamu jeszcze nie miałem…”

  1. Michal 24/04/2008 do 23:13 # Odpowiedz

    Mnie cią­gle ofe­rują powięk­sza­nie penisa. O co im chodzi? :)

    • wyzimir 25/04/2008 do 15:09 # Odpowiedz

      Michal, zasta­nów się dla­czego wybrali wła­śnie Ciebie do swo­jej grupy docelowej.

Dodaj komentarz