Giter Club home page Giter Club logo

text-similarity's Introduction

Installation

Install necessary packages with pip

  pip install scikit-learn
  pip install nltk
  pip install scipy

Processing File

This program computes a TF-IDF Weighted Term document Incident matrix and a text file containing an Inverted Index.

Program Details

The program first reads the text files stored in the files directory of the project and then preprocess the document by removing special characters, stopwords and stemming. After that it computes the TF-IDF Weighted Term document Incident matrix and store it in the project root directory in a npz (NumPyZipped) file. It builds a text file containing the inverted index of terms and their corresponding document.

Prerequisites

Python 3
os
re
scipy
nltk
sklearn

Usage

Place input text files in the files directory of the root of project before executing the preprocess.py file program

To run the program, open a terminal window and navigate to the projects's directory and use the command

python preprocess.py

Output

Output of this program is a npz file containing TF-IDF Weighted Term document Incident matrix and a text file containing an Inverted Index.

Query File

This program calculates and prints the cosine similarity score of the relevant documents on the console or terminal.

Prerequisites

Python 3
re
numpy
scipy
sklearn

Usage

To run the program, open a terminal window and navigate to the projects's directory and use the command

python query.py

After that the program will ask the path of the query file,so enter the query file path

Output

The program will print the cosine similarity between the two documents in decreasing order of their cosine similarity.

text-similarity's People

Contributors

shivamrai15 avatar

Stargazers

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