Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

This repository contains various ways to calculate sentence vector similarity using NLP models

NotificationsYou must be signed in to change notification settings

Huffon/sentence-similarity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repo contains various ways to calculate the similarity between source and target sentences. You can choosethe pre-trained models you want to use such asELMo,BERT andUniversal Sentence Encoder (USE).

And you can also choosethe method to be used to get the similarity:

1. Cosine similarity2. Manhattan distance3. Euclidean distance4. Angular distance5. Inner product6. TS-SS score7. Pairwise-cosine similarity8. Pairwise-cosine similarity + IDF

You can experiment with (The number of models) x (The number of methods) combinations!


Installation

  • This project is developed underconda enviroment
  • After cloning this repository, you can simply install all the dependent libraries described inrequirements.txt withbash install.sh
conda create -n sensim python=3.7conda activate sensimgit clone https://github.com/Huffon/sentence-similarity.gitcd sentence-similaritybash install.sh

Usage

  • Totest your own sentences, you should fill outcorpus.txt with sentences as below:
I ate an apple.I went to the Apple.I ate an orange....
  • Then,choose themodel andmethod to be used to calculate the similarity between source and target sentences
python sensim.py    --model    MODEL_NAME  [use, bert, elmo]    --method   METHOD_NAME [cosine, manhattan, euclidean, inner,                            ts-ss, angular, pairwise, pairwise-idf]    --verbose  LOG_OPTION (bool)

Examples

  • In this section, you can see the example result ofsentence-similarity
  • As you know, there is a nosilver-bullet which can calculateperfect similarity between sentences
  • You should conduct various experiments with your dataset
    • Caution:TS-SS score might not fit withsentence similarity task, since this method originally devised to calculate the similarity between long documents
  • Result:


References

Papers


Libraries


Articles

About

This repository contains various ways to calculate sentence vector similarity using NLP models

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp