Đang Thực Hiện

138376 PHP text similarity calculator

I need a PHP script that calculates the "edit distance" between the contents of two text files, where "edit distance" is defined as the minimal number of word insertions, word deletions, word substitutions and words transpositions (these weighted x0.5) needed to transform the first one into the second one.

Examples of program input (text 1, text 2, i.e. the content of the two text files) and output (edit distance):

text 1: "THIS APPLE IS RED"

text 2: "THIS IS RED"

edit distance = 1

(1 word deletion)

text 1: "THIS IS RED"

text 2: "THIS APPLE IS RED"

edit distance = 1

(1 word insertion)

text 1: "THIS APPLE IS RED"

text 2: "THIS CHERRY IS RED"

edit distance = 1

(1 word substitution)

text 1: "THIS APPLE IS RED"

text 2: "THIS RED IS APPLE"

edit distance = 0.5

(1 word transposition)

text 1: "THIS APPLE IS RED"

text 2: "APPLE RED"

edit distance = 2

(2 word deletions)

text 1: "THIS APPLE IS RED"

text 2: "THIS RED APPLE IS GOOD"

edit distance = 2

(1 word insertion + 1 word substitution)

Requisites:

- it must be fast (less than 1 minute to calculate the edit distance between two completely different 100KB text files )

- it must work with any text file of any lenght (smaller than 200KB...)

Escrow offered.

Demo appreciated.

_____

Note: this "edit distance" that I want is similar to the Damerau-Levenshtein distance whose algorithm (in C) is reported is reported here: [url removed, login to view], with the main difference that this counts the number of diff. characters while I want to count the number of diff. words.

Kỹ năng: Bất kì công việc gì, PHP

Xem thêm: text similarity php, want wikipedia, difference algorithm program, calculator program php, algorithm examples, wikipedia edit, transform word, similarity, php wikipedia, distance calculator, cherry a, apple script, whose content, php script insertion, count words text, php insertion, minimal php, apple program script, php program files, php diff file, calculator php program, edit note file, distance calculate, edit word file php, distance algorithm php

Về Bên Thuê:
( 69 nhận xét ) Milano, Italy

Mã Dự Án: #1884550