https://github.com/krkarma777/string-difference-finder
A web tool to compare and highlight differences between two strings.
https://github.com/krkarma777/string-difference-finder
compare-strings diff
Last synced: 12 months ago
JSON representation
A web tool to compare and highlight differences between two strings.
- Host: GitHub
- URL: https://github.com/krkarma777/string-difference-finder
- Owner: krkarma777
- Created: 2024-05-20T13:56:56.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-25T21:22:20.000Z (about 2 years ago)
- Last Synced: 2025-04-21T05:42:20.450Z (about 1 year ago)
- Topics: compare-strings, diff
- Language: JavaScript
- Homepage:
- Size: 93.8 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# String Difference Finder

## Overview
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.
## Features
- **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.
## Getting Started
### Prerequisites
- 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)
### Installation
1. Clone the repository:
```sh
git clone https://github.com/krkarma777/string-difference-finder.git
cd string-difference-finder
```
2. Build and run the Spring Boot application:
```sh
./gradlew bootRun
```
3. Open your web browser and navigate to:
```
http://localhost:8090/
```
### Usage
1. Enter the first string in the "First String" textarea.
2. Enter the second string in the "Second String" textarea.
3. Click the "Show Difference" button to see the highlighted differences.
### Example
```html
String Difference Finder
String Difference Finder
First String:
committer_list_per_month[date + '-' + log[i].author] = 1;
Second String:
var date_author = date + '-' + log[i].author;
Show Difference
```
## Configuration
The application can be configured using the `application.properties` file:
```properties
spring.application.name=TextDiffTool
server.port=8090
```
## References
- **Myer's Diff Algorithm**:
- [A technique for isolating differences between files](http://portal.acm.org/citation.cfm?doid=359460.359467)
- [An Algorithm for Differential File Comparison](https://www.cs.dartmouth.edu/~doug/diff.pdf)
- **Diff-match-patch**:
- [Google's diff-match-patch library](https://github.com/google/diff-match-patch)
- **Pre-diff speedups and post-diff cleanups**:
- [Neil Fraser's writing on diff](https://neil.fraser.name/writing/diff/)
- **Hirschberg Algorithm**:
- [Algorithms for the Longest Common Subsequence Problem](https://dl.acm.org/doi/pdf/10.1145/322033.322044)
- [Optimal Sequence Alignment Algorithm Using Space Division Technique](https://scienceon.kisti.re.kr/commons/util/originalView.do?cn=JAKO200727543156559&oCn=JAKO200727543156559&dbt=JAKO&journal=NJOU00291531&keyword=%EC%B5%9C%EC%A0%81%20%EC%84%9C%EC%97%B4%EC%A0%95%EB%A0%AC)
## Contributing
Welcome contributions to improve this tool! Here are some ways you can help:
- Reporting issues
- Adding new features
- Improving documentation
To contribute:
1. Fork the repository
2. Create a new branch (`git checkout -b feature/your-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin feature/your-feature`)
5. Create a new Pull Request
## Contact
For any inquiries, please contact [krkarma777@gmail.com](mailto:krkarma777@gmail.com) or open an issue on GitHub.