Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andriikot/smartmatch
Smart Match with python
https://github.com/andriikot/smartmatch
Last synced: about 1 month ago
JSON representation
Smart Match with python
- Host: GitHub
- URL: https://github.com/andriikot/smartmatch
- Owner: AndriiKot
- Created: 2024-11-26T10:48:39.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-26T11:36:01.000Z (about 1 month ago)
- Last Synced: 2024-11-26T11:45:55.843Z (about 1 month ago)
- Language: Jupyter Notebook
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SmartMatch
This project is designed to find the most similar
song based on the text provided by the user.
It utilizes a transformer model from the `transformers`
library for vectorizing song lyrics and computes
similarity using cosine similarity.## Technologies:
Python
Jupyter
Hugging Face
PyTorch
NumPy
scikit-learn
## Contents
- [Functionality](#functionality)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Notes](#notes)## Functionality
The program allows you to:
- Load song lyrics from text files.
- Vectorize song lyrics using the `distilbert-base-uncased` model.
- Find the most similar song based on the user-provided text.## Requirements
To run the program, you need to install the following libraries:
- `transformers`
- `torch`
- `scikit-learn`## Installation
To install the necessary libraries, run the following command in your Jupyter Notebook:
```python
!pip install transformers torch scikit-learn
```## Usage
1. **Data Preparation:**
- Create a folder named `data` in the directory where your Jupyter Notebook is located.
- Place text files containing the song lyrics in this folder. Make sure all files have a `.txt` extension.2. **Running the Program:**
- Open your Jupyter Notebook.
- Copy and paste the provided program code into the cells of your notebook.
- Execute the cells in the following order:
- A cell for importing libraries and loading the song lyrics.
- A cell for inputting the user text and searching for a similar song.3. **Text Input:**
- After running the code, enter the text for which you want to find a similar song when prompted.Example code for text input:
```python
user_input = input("Please enter the text you want to find a similar song for: ")
similar_song_name, similarity_score = find_similar_song(user_input)
print(f"The most similar song is: {similar_song_name} with a similarity score of {similarity_score:.4f}")
```## Notes
- If you do not have a Graphics Processing Unit (GPU), make sure that `PyTorch` is installed with CPU support, or simply use the CPU as your device.
- Depending on the volume of songs you have loaded and the power of your computer, vector calculation may take some time.## License
This project is licensed under the MIT License. Please refer to the LICENSE file for more details.