GithubHelp home page GithubHelp logo

akhilsoni0102 / semantic-similarity-between-2-sentences Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 7.82 MB

This repository contains a simple code to compare two sentences based on their semantic similarity scores using a Universal sentence encoder.

License: MIT License

Jupyter Notebook 100.00%
semantic-similarity tensorflow-models tensorflow python3 jupyter-notebook cosine-similarity cosine-similarity-scores universal-sentence-encoder universal-sentences-encoder universal-sentence-encoders

semantic-similarity-between-2-sentences's Introduction

Semantic Similarity between 2 sentences:

Problem Statement:

Given two paragraphs, quantify the degree of similarity between the two text-based on Semantic similarity. Semantic Textual Similarity (STS) assesses the degree to which two sentences are semantically equivalent to each other. STS is the assessment of pairs of sentences according to their degree of semantic similarity. The task involves producing real-valued similarity scores for sentence pairs. Data Description: The data contains a pair of paragraphs. These text paragraphs are randomly sampled from a raw dataset. Each pair of the sentence may or may not be semantically similar. The candidate is to predict a value between 0-1 indicating a degree of similarity between the pair of text paras.

  • 1: Highly similar
  • 0: Highly dissimilar

Approach:

This is a problem of Natural Language Processing (NLP) and before building any deep learning model in NLP, text embedding plays a major role. Text embedding converts text (sentences in our case) into numerical vectors. After converting the sentences into vectors we can calculate how close these vectors are based on euclidean distance/ cosine similarity or any other method. and that itself can tell how similar our sentences are. In our case, we have used cosine similarity.

But, how to convert keywords into vectors? we are not converting just based on keywords but the context and meaning. We have used Universal Sentence Encoder(USE). It encodes text into higher dimensional vectors that can be used for our semantic similarity task. The pre-trained Universal Sentence Encoder(USE) is publicly available in the TensorFlow hub. I used USE4 because it is the state-of-the-art transformer-based model for NLP. And is trained on a huge corpus of datasets from wikipedia.

semantic-similarity-between-2-sentences's People

Contributors

akhilsoni0102 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

koffi09 anup00900

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.