https://github.com/abhilash1910/bertsimilarity
Sentential Semantic Similarity measurement library using BERT Embeddings for spatial distance evaluation.
https://github.com/abhilash1910/bertsimilarity
bert bert-model bert-tokenizer cosine-distance pytorch scipy transformers-library
Last synced: 18 days ago
JSON representation
Sentential Semantic Similarity measurement library using BERT Embeddings for spatial distance evaluation.
- Host: GitHub
- URL: https://github.com/abhilash1910/bertsimilarity
- Owner: abhilash1910
- License: other
- Created: 2020-11-24T18:22:17.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-14T19:00:05.000Z (over 4 years ago)
- Last Synced: 2025-04-12T23:35:25.834Z (18 days ago)
- Topics: bert, bert-model, bert-tokenizer, cosine-distance, pytorch, scipy, transformers-library
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 27
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.TXT
Awesome Lists containing this project
README
# BERTSimilarity
## A BERT Embedding library for sentence semantic similarity measurement :robot:
This library is a sentence semantic measurement tool based on BERT Embeddings. It uses the forward pass of the BERT (bert-base-uncased) model for estimating the embedding vectors and then applies the generic cosine formulation for distance measurement. The distance metric can be changed and the intermediate sentence and word embedding vectors can be attained as well. The model has been abstracted from the Google Research's [BERT implementation](https://github.com/google-research/bert/).The pytorch wrapper over BERT is credited to Chris McCormick.
## Dependencies
## Usability
Installation is carried out using the pip command as follows:
```python
pip install BERTSimilarity==0.1
```For using inside the Jupyter Notebook or Python IDE:
```python
import BERTSimilarity.BERTSimilarity as bertsimilarity
```The 'Similarity_Test.py' file contains an example of using the Library in this context.
## Samples
A sample of semantic similarity measurement with 4 different sentences , 2 of which are vaguely similar is provided below:
This [Colab Notebook](https://colab.research.google.com/drive/1OfFYGRdW3I8cMxL6Nj4KZd78PoiR4Lg0?usp=sharing) can be used as well for experimentation.
A Kaggle Kernel for [Question Pair Similarity](https://www.kaggle.com/abhilash1910/bertsimilarity-library) detection is also provided which uses this library.
The Notebook is featured in [QuantumStat.com](https://notebooks.quantumstat.com/)
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## License
MIT