Giter VIP home page Giter VIP logo

zahrasalarian / information-retrieval Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 50.75 MB

A query answerer, written in Python, using the ISNA news agency database, by employing tf-idf and k-means clustering algorithms. It also classifies unlabeled news as one of the health, sports, culture, politics, and economy categories.

Jupyter Notebook 100.00%
champion-list cosine-similarity inverted-index kmeans-clustering knn-classification max-heap tf-idf

information-retrieval's Introduction

Information Retrieval

Phase 1: Query answerer using simple inverted indexes

In this phase, tokenization and specific Persian normalization were developed in the following order:

  • Tokenization --> tokenize()
  • Normalization
    • equalize_chars()
    • delete_pishvand()
    • root_of_verbs()
    • del_stop_w()
    • del_punctuations()
    • mokasar()
    • del_pasvand()
  • Building inverted indexes
  • Answering single and multi word queries (not in a ranked display) by outputting the relative link.

Phase 2: Ranked query answerer using tf-idf, heap, and Champion lists

This phase contains the implementation of some famous efficiency boosting techniques in NLP. The developed methods respectively are:

  • Building Weighted Inverted Index using tf-idf vector representation, resulting from the following equation:

tf-idf equation

Where ft,d stands for the number of repetitions of word t in document d, and nt is the number of documents in which the word t has appeared.

  • Employing Index elimination technique to reduce the occupied space.
  • Similarity calculation using cosine-sim through the following equation:

tf-idf equation

  • Building tf based Champion lists
  • Outputting K-top results using max-heap

Phase 3: Optimizing the retrieval system with the assistance of K-means clustering and KNN classification.

When the volume of our data increases, we need to apply more efficient methods to exceed the time and space limitations, using the following algorithms:

  • K-means: we cluster the documents through this algorithm with k = 10 and 30 iterations. Responding to a query is by first computing the similarity of the query to the centroids, choosing the highest one, and then finding the responses in that cluster.

  • KNN: Using this algorithm, we implement a classification system with 5 categories including "health", "politics", "sports", "culture",and "economy". This engine labels the documents and sets k to 5. The input query format should be as follows:

cat:<cat> <query>

For example: 
cat:health کرونا

information-retrieval's People

Stargazers

 avatar  avatar  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.