SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast jaked409's Avatar
    Join Date
    Jan 2007
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Subtractive Text Comparison?

    We have a database full of articles, and each article can have multiple versions. There is one "source" version (the full version of the article), and all other versions have some of the text cut out. This is the ONLY change in any of the other versions: nothing is ever added or moved around, just removed.

    We'd like a tool that allows us to look at these altered versions of the text and allow us to see how they've changed from the original. An example of how the tool might work (just an interface example, so you get the idea if my explanation was unclear): You pick an article, then pick a version of the article. The text appears normally, but any text that's in the original and NOT in the currently chosen version appears with a red background, so it's clear that those pieces of text have been removed from the currently chosen version.

    Since the only changes that can be made are subtractive, I don't see this as being too difficult a project. However, I was wondering if there's anything that's already available that either provides this functionality, or can assist in providing it?

    Right now, I'm planning on just using strcmp() to go through each bit of text until it comes across parts that don't match, and then start marking those parts as changed until they start matching again. Let me know if there's anything that can assist with this please.
    jakeboxer.com (my portfolio)

  2. #2
    <?php while(!sleep()){code();} G.Schuster's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have a look at XDiff: http://www.php.net/xdiff
    Saves much of your time and ressources.

  3. #3
    SitePoint Enthusiast jaked409's Avatar
    Join Date
    Jan 2007
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks good, we might use it, but we'd prefer not to alter our PHP installation. Anything else?
    jakeboxer.com (my portfolio)

  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    most if not all wikis have a diff feature, there are plenty of modules out there

    see for example

    http://svn.wikimedia.org/viewvc/medi...hp?view=markup

  5. #5
    SitePoint Enthusiast jaked409's Avatar
    Join Date
    Jan 2007
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    awesome thanks for all the help guys, i think im all set now.
    jakeboxer.com (my portfolio)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •