Skip to content

Instantly share code, notes, and snippets.

@thisisarjuns
thisisarjuns / lv_similarity.py
Created August 1, 2024 11:55
lv distance similarity
import rapidfuzz
def get_confidence_lv(init_data_name: str, document_name: str) -> float:
edit_distance = rapidfuzz.distance.Levenshtein.distance(init_data_name, document_name)
similarity = 1 - (edit_distance / max(len(init_data_name), len(document_name)))
return round(similarity, 2)
input = [
("Arjun", "Arjun" ),
@thisisarjuns
thisisarjuns / check-response.json
Created January 2, 2023 14:42
sample check response
[
[
{
"created_at": "2023-01-02T12:47:24.779041",
"data": {
"aws_response": {
"FaceDetails": [
{
"AgeRange": {
"High": 42,