PHP Classes

class has problems with longer strings

Recommend this page to a friend!

      PHP Text Diff Highlight class  >  All threads  >  class has problems with longer strings  >  (Un) Subscribe thread alerts  
Subject:class has problems with longer strings
Summary:fails to locate duplicate content
Messages:8
Author:Todd Southwick
Date:2016-04-30 06:32:37
 

  1. class has problems with longer strings   Reply   Report abuse  
Picture of Todd Southwick Todd Southwick - 2016-04-30 06:32:37
before
-------
Sunflower Silicone Soap Bar Mold Soap Molds JavaScript seems to be disabled in your browser You must have JavaScript enabled in your browser to utilize the functionality of this website My Account My Wishlist Checkout Blog Log In Welcome to TopMolds Top Molds My Shopping Cart 0 items 0 00 Checkout You have no items in your shopping cart Our orders ship within 24 hours from Los Angeles California USA Home Candy Molds Chocolate Molds Soap Molds Candle Molds Baking Molds On Sale Search Search Home Soap Molds Sunflower Silicone Soap Bar Mold Prev Next More Views Sunflower Silicone Soap Bar Mold Be the first to review this product 12 00 In stock Qty Add to Cart Add to Wishlist Add to Compare Email to a Friend Tweet Description Product Tags Details Wavy Side with Sunflower Silicone Soap Mold Product Tags Add Your Tags Add Tags Use spaces to separate tags Use single quotes for phrases Reviews Write Your Own Review Only registered users can write reviews Please log in or register Categories Candy Molds Chocolate Molds Soap Molds Candle Molds Baking Molds Information About Us Blog 1 For The Arts Charity Privacy Policy Terms Conditions Site Map Support Contact Us Shipping Policy Returns Advanced Search Newsletter Sign Up for Our Newsletter Subscribe Website Design by Submit Digital Additional options

-----------
after
-----------
3D Speak No Evil Silicone Soap or Candle Mold Candle Molds JavaScript seems to be disabled in your browser You must have JavaScript enabled in your browser to utilize the functionality of this website My Account My Wishlist Checkout Blog Log In Welcome to TopMolds Top Molds My Shopping Cart 0 items 0 00 Checkout You have no items in your shopping cart Our orders ship within 24 hours from Los Angeles California USA Home Candy Molds Chocolate Molds Soap Molds Candle Molds Baking Molds On Sale Search Search Home Candle Molds 3D Speak No Evil Silicone Soap or Candle Mold Prev Next More Views 3D Speak No Evil Silicone Soap or Candle Mold Be the first to review this product 18 00 In stock Qty Add to Cart Add to Wishlist Add to Compare Email to a Friend Tweet Description Product Tags Details The famous monkeys from the hear speak or see no evil works have been separated into separate entities This monkey represents speak no evil He will be a good reminder for you not to spread gossip about your enemies or even your friends Malicious talk only hurts people who are close to you If you need a daily reminder in the form of monkey then do not be too hard on yourself It will get easier over time In the meantime create soap see no evil monkeys for all your friends so that they get a gentle hint that gossip hurts Product Tags Add Your Tags Add Tags Use spaces to separate tags Use single quotes for phrases Reviews Write Your Own Review Only registered users can write reviews Please log in or register Categories Candy Molds Chocolate Molds Soap Molds Candle Molds Baking Molds Information About Us Blog 1 For The Arts Charity Privacy Policy Terms Conditions Site Map Support Contact Us Shipping Policy Returns Advanced Search Newsletter Sign Up for Our Newsletter Subscribe Website Design by Submit Digital Additional options

  2. Re: class has problems with longer strings   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2016-04-30 19:10:24 - In reply to message 1 from Todd Southwick
In this case it is better to perform comparisons by word. I tried the text_diff.php example here and it worked as expected. Did you try compare by word?

  3. Re: class has problems with longer strings   Reply   Report abuse  
Picture of Todd Southwick Todd Southwick - 2016-05-02 23:58:53 - In reply to message 2 from Manuel Lemos
I did. Below I added the subtractions, equals and additions. There should be much more equals. Like 1000. If I truncate the two samples I can get better results. I wish this forum supported images.

-1183
+1706
=128
======================================================================================================
stdClass Object ( [mode] => w [patch] => 1 [difference] => Array ( [0] => Array ( [change] => - [position] => 0 [length] => 10 ) [1] => Array ( [change] => + [position] => 0 [length] => 17 [patch] => 3D Speak No Evil ) [2] => Array ( [change] => = [position] => 10 [length] => 14 ) [3] => Array ( [change] => - [position] => 24 [length] => 4 ) [4] => Array ( [change] => + [position] => 31 [length] => 10 [patch] => or Candle ) [5] => Array ( [change] => = [position] => 28 [length] => 5 ) [6] => Array ( [change] => + [position] => 46 [length] => 405 [patch] => Candle Molds JavaScript seems to be disabled in your browser You must have JavaScript enabled in your browser to utilize the functionality of this website My Account My Wishlist Checkout Blog Log In Welcome to TopMolds Top Molds My Shopping Cart 0 items 0 00 Checkout You have no items in your shopping cart Our orders ship within 24 hours from Los Angeles California USA Home Candy Molds Chocolate Molds ) [7] => Array ( [change] => = [position] => 33 [length] => 11 ) [8] => Array ( [change] => - [position] => 44 [length] => 17 ) [9] => Array ( [change] => + [position] => 462 [length] => 192 [patch] => Candle Molds Baking Molds On Sale Search Search Home Candle Molds 3D Speak No Evil Silicone Soap or Candle Mold Prev Next More Views 3D Speak No Evil Silicone Soap or Candle Mold Be the first ) [10] => Array ( [change] => = [position] => 61 [length] => 3 ) [11] => Array ( [change] => + [position] => 657 [length] => 287 [patch] => review this product 18 00 In stock Qty Add to Cart Add to Wishlist Add to Compare Email to a Friend Tweet Description Product Tags Details The famous monkeys from the hear speak or see no evil works have been separated into separate entities This monkey represents speak no evil He will ) [12] => Array ( [change] => = [position] => 64 [length] => 3 ) [13] => Array ( [change] => - [position] => 67 [length] => 9 ) [14] => Array ( [change] => + [position] => 947 [length] => 168 [patch] => a good reminder for you not to spread gossip about your enemies or even your friends Malicious talk only hurts people who are close to you If you need a daily reminder ) [15] => Array ( [change] => = [position] => 76 [length] => 3 ) [16] => Array ( [change] => + [position] => 1118 [length] => 140 [patch] => the form of monkey then do not be too hard on yourself It will get easier over time In the meantime create soap see no evil monkeys for all ) [17] => Array ( [change] => = [position] => 79 [length] => 5 ) [18] => Array ( [change] => - [position] => 84 [length] => 41 ) [19] => Array ( [change] => + [position] => 1263 [length] => 232 [patch] => friends so that they get a gentle hint that gossip hurts Product Tags Add Your Tags Add Tags Use spaces to separate tags Use single quotes for phrases Reviews Write Your Own Review Only registered users can write reviews Please log ) [20] => Array ( [change] => = [position] => 125 [length] => 3 ) [21] => Array ( [change] => - [position] => 128 [length] => 90 ) [22] => Array ( [change] => + [position] => 1498 [length] => 109 [patch] => or register Categories Candy Molds Chocolate Molds Soap Molds Candle Molds Baking Molds Information About Us ) [23] => Array ( [change] => = [position] => 218 [length] => 5 ) [24] => Array ( [change] => - [position] => 223 [length] => 116 ) [25] => Array ( [change] => + [position] => 1612 [length] => 146 [patch] => 1 For The Arts Charity Privacy Policy Terms Conditions Site Map Support Contact Us Shipping Policy Returns Advanced Search Newsletter Sign Up for ) [26] => Array ( [change] => = [position] => 339 [length] => 4 ) [27] => Array ( [change] => - [position] => 343 [length] => 869 ) [28] => Array ( [change] => = [position] => 1212 [length] => 11 ) [29] => Array ( [change] => - [position] => 1223 [length] => 27 ) [30] => Array ( [change] => = [position] => 1250 [length] => 61 ) )

  4. Re: class has problems with longer strings   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2016-05-03 02:14:57 - In reply to message 3 from Todd Southwick
I did not check all that output, so it would be more useful if you captured a screenshot and post it somewhere like for instance http://imgur.com/ .

  5. Re: class has problems with longer strings   Reply   Report abuse  
Picture of Todd Southwick Todd Southwick - 2016-05-03 05:48:22 - In reply to message 4 from Manuel Lemos

  6. Re: class has problems with longer strings   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2016-05-03 20:05:52 - In reply to message 5 from Todd Southwick
Looks correct to me. The algorithm tries to to find longest common sub-sequence of words and then finds the differences of words to add or remove.

en.wikipedia.org/wiki/Longest_commo ...

  7. Re: class has problems with longer strings   Reply   Report abuse  
Picture of Todd Southwick Todd Southwick - 2016-05-03 20:31:52 - In reply to message 6 from Manuel Lemos
Wouldn't that be this string: "JavaScript seems to be disabled in your browser You must have JavaScript enabled in your browser to utilize the functionality of this website My Account My Wishlist Checkout Blog Log In Welcome to TopMolds Top Molds My Shopping Cart 0 items 0 00 Checkout You have no items in your shopping cart Our orders ship within 24 hours from Los Angeles California USA" Which exists in both strings.

  8. Re: class has problems with longer strings   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2016-05-03 21:00:00 - In reply to message 7 from Todd Southwick
No, the longest common subsequence does not mean that the words are present in both texts in the exact sequence. There may be words inserted in the middle.

Anyway, the Wikipedia article explains it better. I just followed that algorithm.