String Difference Finder is a web-based tool that allows you to compare two strings and visualize their differences. It highlights deletions in red and insertions in green, providing an intuitive way to understand changes between two versions of text. The tool leverages parallel processing to optimize the performance of the Longest Common Subsequence (LCS) algorithm, making it efficient for large inputs.
- Token-based Diffing: Splits strings into meaningful tokens for more accurate and readable diffs.
- Parallel Processing: Utilizes parallel processing in LCS calculations to improve performance.
- Visual Highlighting: Highlights deletions and insertions in red and green, respectively.
- Performance Metrics: Displays the time taken to compute the differences.
- User-friendly Interface: Simple and intuitive web interface for comparing strings.
- Java Development Kit (JDK) 17 or later
- A web browser (Chrome, Firefox, Safari, etc.)
- A web server to host the HTML and JavaScript files (optional for local usage)
-
Clone the repository:
git clone https://github.com/krkarma777/string-difference-finder.git cd string-difference-finder
-
Build and run the Spring Boot application:
./gradlew bootRun
-
Open your web browser and navigate to:
http://localhost:8090/
- Enter the first string in the "First String" textarea.
- Enter the second string in the "Second String" textarea.
- Click the "Show Difference" button to see the highlighted differences.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>String Difference Finder</title>
<link rel="stylesheet" href="/stylesheet/diff.css"/>
</head>
<body>
<h1>String Difference Finder</h1>
<label for="string1">First String:</label>
<textarea id="string1" placeholder="Enter first string">
committer_list_per_month[date + '-' + log[i].author] = 1;
</textarea>
<br>
<label for="string2">Second String:</label>
<textarea id="string2" placeholder="Enter second string">
var date_author = date + '-' + log[i].author;
</textarea>
<br>
<button onclick="findDifference()">Show Difference</button>
<div id="result" class="difference"></div>
<script src="/js/diff.js"></script>
</body>
</html>
The application can be configured using the application.properties
file:
spring.application.name=TextDiffTool
server.port=8090
- Myer's Diff Algorithm:
- Diff-match-patch:
- Pre-diff speedups and post-diff cleanups:
- Hirschberg Algorithm:
Welcome contributions to improve this tool! Here are some ways you can help:
- Reporting issues
- Adding new features
- Improving documentation
To contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature
) - Create a new Pull Request
For any inquiries, please contact krkarma777@gmail.com or open an issue on GitHub.