forked from Vishwajeetk87/text_compare
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea33a25
commit 76c9fa8
Showing
1 changed file
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,35 @@ | ||
# text_compare | ||
# text_compare | ||
|
||
**Background**: | ||
text_compare is a service which will compare given two input texts and return the Match count and Match score. | ||
|
||
Match Count: common Subsequence between two texts | ||
Match score: Score will range between 0 and 1 where 0 is no match and 1 will be the exact match. | ||
|
||
The comparison logic makes use of Longest common subsequence algorithm to find the match. | ||
|
||
Metric used for comparison is simple , score is calculated using formula (length_of subsequence)/max(len_of_text1,len_of_text2) | ||
|
||
|
||
**Running the Application**: | ||
|
||
This application is using flask to create an endpoint ,the starting point for application is core.py simply execute following to start the app. | ||
|
||
- python core.py | ||
|
||
- URL for POST method : http://localhost/compare/ | ||
- Payload is in json format : -d '{"text1":"foo bar", "text2":"bar"}' | ||
|
||
- Result | ||
{ | ||
Match Count : 1, | ||
Match Score : 0.5 | ||
} | ||
|
||
- This application was tested using POSTMAN | ||
|
||
Sample Curl | ||
curl -X POST \ | ||
http://127.0.0.1:5000/compare/ \ | ||
-H 'content-type: application/json' \ | ||
-d '{"text1":"foo bar", "text2":"bar"}' |