GithubHelp home page GithubHelp logo

thamindudilshan / sinhala-lyrics-search-engine Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 3.0 3.79 MB

Repository for IR Project: Sinhala Lyrics Search Engine

Python 34.30% JavaScript 4.09% TypeScript 39.36% CSS 4.88% HTML 17.37%
search-engine lyrics-search lyrics-finder elasticsearch

sinhala-lyrics-search-engine's Introduction

Sinhala Lyrics Search Engine

This is a simple lyrics search engine created using Elasticsearch for sinhala songs. The project consists of a Angular frontend and a Python Flask backend server.

Lyric Search Engine Architecture Diagram

Getting Started

Setting Up Elasticsearch

  1. Download and run Elasticsearch.

This project was made using Elasticsearch version 7.7.1. Query formats may get changed in future versions.

  1. Install ICU Analysis plugin.
  2. Optionally install Kibana for below query operations.

Setting Up the Index

Alternatively, you can restore the index from the provided elasticsearch snapshot in the es_snapshots/ folder See more on snapshot and restore

  1. Create an index named sinhala_lyrics_tokenized in the Elasticsearch and execute below queries.
PUT /sinhala_lyrics_tokenized
{
  "settings": {
    "index": {
      "analysis": {
        "analyzer": {
          "sinhalaAnalyzer": {
            "type": "custom",
            "tokenizer": "icu_tokenizer",
            "filter": ["edgeNgram"],
            "char_filter": ["dotFilter"]
          }
        },
        "filter": {
          "edgeNgram": {
            "type": "edge_ngram",
            "min_gram": 2,
            "max_gram": 50,
            "side": "front"
          }
        },
        "char_filter": {
          "dotFilter": {
            "type": "mapping",
            "mappings": ". => \\u0020"
          }
        }
      }
    }
  }
}
PUT sinhala_lyrics_tokenized/_mappings/
{
  "properties": {
    "artist": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      },
      "analyzer": "sinhalaAnalyzer",
      "search_analyzer": "standard"
    },
    "beat": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      }
    },
    "genre": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      },
      "analyzer": "sinhalaAnalyzer",
      "search_analyzer": "standard"
    },
    "key": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      }
    },
    "lyric": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      },
      "analyzer": "sinhalaAnalyzer",
      "search_analyzer": "standard"
    },
    "lyricWriter": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      },
      "analyzer": "sinhalaAnalyzer",
      "search_analyzer": "standard"
    },
    "musicDirector": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      },
      "analyzer": "sinhalaAnalyzer",
      "search_analyzer": "standard"
    },
    "shares": {
      "type": "long"
    },
    "songName": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      },
      "analyzer": "sinhalaAnalyzer",
      "search_analyzer": "standard"
    },
    "url": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      }
    },
    "views": {
      "type": "long"
    }
  }
}

  1. Download Sinhala Lyrics Corpus and add documents to the created index using the Bulk API.

You may use Kibana/ Sense or any other option for above query operations.

Setting Up the Python Server

  1. Install python and pip version 3
  2. Install required python packages by running the following command in the project home directory. $ pip install -r requirements.txt
  3. Download and setup SinLing. You may have to append project path to your path environment variable.
  4. Configure the index name and Elasticsearch host:port details in /python-backend-server/main.py file.
index_name = 'sinhala_lyrics_tokenized'
es = Elasticsearch('localhost', port=9200)

Setting Up Angular Front-end

  1. Download and install required node packages by running npm install in the /lyrics-search-engine/ directory.

Running the Project

  1. Run the Elasticsearch instance.
  2. Run the Python backend server by executing python main.py in the /python-backend-server/ directory.
  3. Run the Angular web app by executing ng serve --open command in the /lyrics-search-engine/ directory.

Basic Usage Examples

  • Search by a song name. search by song name example

  • Search by an artist name. search by artist name example

  • Search by the lyric writer. search by lyric writer example

  • Search for popular songs. search for popular songs example

  • Search using the English language. Searching song names and lyrics in English is not yet supported (You have to switch the language to English from the UI). search by english example

  • Perform an advanced search with more options. advance search example

Additional Details

The project utilizes the below query types in Elasticsearch.

Aditionally, below query options were also used.

This project uses the Sinhala Tokenizer from SinLing, a language processing tool for Sinhala language.

Also, the project uses a Sinhala Stemmer from 'https://github.com/e11379dana/SinhalaStemming'.

English to Sinhala translations are done using the translate python package.

sinhala-lyrics-search-engine's People

Contributors

thamindudilshan avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.