Question: Given two strings input of printable text, a and b. let the edit distance between a and b is least number of operations needed

Given two strings input of printable text, a and b. let the     

Given two strings input of printable text, a and b. let the edit distance between a and b is least number of operations needed to transform a to b, write php code that calculate edit distance using: 1. hamming distance that only have substitute operations (ex. substitute letter X with letter Y). 2. Levenshtein distance: that have 3 possible operators: insert, delete or substitution operations the function should consider all possibilities but should not consider the same part twice, and report the smallest possible distance hamming_dis(a, b) returns integer levenshtein_dis(a, b) returns integer Your code should use the following: 1. OOP 2. two classes one for each mode hamming or levenshtein 2. do the calculation and return the result 3. define protected/private properties as needed to hold input strings and intermediate data that you use private/protected methods that you call recursively if needed those methods should take offset from the beginning of input texts instead of passing substrings 5. 6. one public static helper that creates an instance, initialise the state, 7. document/comment your code write another file that requires your file as a library and perform some tests on 8. it 9. write another command line tool that prompt for two input strings and display the levenshtein distance 10. write a web page with a form of two fields and returns the levenshteindistance, provide instructions to run it using PHP's builtin web server from command line example levenshtein distances a: "this is a test" b: "this is test" levenshtein: 2 operations (remove a and next space) a: "this is test" b: "the is test" levenshtein: 2 operations (replace i with e in this and remove s)

Step by Step Solution

3.52 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Import the necessary libraries import javau... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!