{"id":719,"date":"2024-11-04T13:32:12","date_gmt":"2024-11-04T13:32:12","guid":{"rendered":"http:\/\/localhost\/?p=719"},"modified":"2024-11-04T13:33:30","modified_gmt":"2024-11-04T13:33:30","slug":"check-similarity","status":"publish","type":"post","link":"https:\/\/studaca.online\/check-similarity\/","title":{"rendered":"Check Similarity"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Sentence Comparison<\/title>\n    <script>\n        async function query(sentence1, sentence2) {\n            const response = await fetch(\n                \"https:\/\/api-inference.huggingface.co\/models\/sentence-transformers\/paraphrase-MiniLM-L6-v2\",\n                {\n                    headers: {\n                        Authorization: \"Bearer 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\",\n                        \"Content-Type\": \"application\/json\",\n                    },\n                    method: \"POST\",\n                    body: JSON.stringify({\n                        inputs: {\n                            source_sentence: sentence1,\n                            sentences: [sentence2] \/\/ Pass the second sentence as an array\n                        }\n                    }),\n                }\n            );\n            const result = await response.json();\n            return result;\n        }\n\n        function handleSubmit(event) {\n            event.preventDefault(); \/\/ Prevent the default form submission\n\n            const sentence1 = document.getElementById('sentence1').value;\n            const sentence2 = document.getElementById('sentence2').value;\n\n            query(sentence1, sentence2).then((response) => {\n                console.log(JSON.stringify(response));\n                \/\/ Optionally display the response in a user-friendly format\n                document.getElementById('result').innerText = JSON.stringify(response);\n            });\n        }\n    <\/script>\n<\/head>\n<body>\n    <h1>Sentence Comparison Tool<\/h1>\n    <form onsubmit=\"handleSubmit(event)\">\n        <label for=\"sentence1\">First Sentence:<\/label><br>\n        <input type=\"text\" id=\"sentence1\" required><br><br>\n        \n        <label for=\"sentence2\">Second Sentence:<\/label><br>\n        <input type=\"text\" id=\"sentence2\" required><br><br>\n        \n        <input type=\"submit\" value=\"Compare Sentences\">\n    <\/form>\n    \n    <h2>Results:<\/h2>\n    <pre id=\"result\"><\/pre>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Sentence Comparison Sentence Comparison Tool First Sentence: Second Sentence: Results:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-719","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/comments?post=719"}],"version-history":[{"count":2,"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/719\/revisions"}],"predecessor-version":[{"id":721,"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/719\/revisions\/721"}],"wp:attachment":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/media?parent=719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/categories?post=719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/tags?post=719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}