Stringcompare takes 2 texts in a POST request and returns a percentage of common words.
Stringcompare reponds to a POST request with curls default header which includes Content-Type: application/x-www-form-urlencoded
This application could be upgraded later to also support other types of requests such as JSON.
This application compares the similarity of the text based on word matching of each. Sentences with a high percentage of matching words, regardless of order, will be considered similar.
Ways to improve this application:
- Giving weight to consecutive matched words would provide a better indicator of similarity.
- Allow matching of conjunctions to their non-conjoined pair with weight penalty. (can't vs can not)
- Incorporate all types of post requests.
Stringcompare can be installed as a Golang Package, executable, or as a docker container.
Make sure you have Golang installed per the instructions found here.
git clone https://github.com/psheets/stringcompare
cd ./stringcompare
go run main.go
Download appropriate executable for your operating system from here.
Run executable per operating systems norm.
git clone https://github.com/psheets/stringcompare
cd ./stringcompare
docker build -t stringcompare .
docker run -p 8080:8080 stringcompare
or pull from Dockerhub
docker pull psheets88/stringcompare-app:latest
docker run -p 8080:8080 stringcompare
Stringcompare will respond to a post request with a post request containing two sample texts in x-www-form-urlencoded format.
Example using CURL
curl -d "sample_one=<SAMPLE ONE HERE>&sample_two=<SAMPLE TWO HERE>" http://localhost:8080
Example using Postman
You can test this application using https://stringcompare-igftb.ondigitalocean.app
curl -d "sample_one=Test number one.&sample_two=Test number two." https://stringcompare-igftb.ondigitalocean.app