How does php compare two paragraphs?

Source: Internet
Author: User
Tags php compare
How can I compare two texts? It is how to give two paragraphs of text, and mark the modification process like the correction process after dictation to compare the two strings (paragraphs) insert, modify (based on characters), delete. Github example...

How can I compare two texts?

It is how to give two paragraphs of text, and mark the modification process like the correction process after dictation to compare the two strings (paragraphs) insert, modify (based on characters), delete. The github example is very good, but it does not seem to be a minimal edit, rather than a word-by-word operation.

For example:

1st sentence: Why I Cann't changed it. Becuase we can't.

2nd sentence: Why we can't change it now? Because you can.

The program can compare the two sentences, find the differences, automatically skip the same part, and mark different places.

How does php implement this algorithm? A score is also given. Is it related to the editing distance? Keyword: php diff? Or compare strings?

Take Hujiang as an example: http://ting.hujiang.com/mansu...

I think https://github.com/kijtra/tex...this algorithm is not as useful as Shanghai:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.