Code Monkey home page Code Monkey logo

document-similarity's Introduction

Context-based similar documents


1. Introduction

In this repository, I implemented Context-based similar documents according to Rich Anchor's blog

Context-based similar documents is a problem that finding the most similar documents of the given document. The blog's approach is using LDA (Latent Dirichlet Allocation) Model to build the generic topics of the documents in database, then vectorize them, and using LSH (Locality Sensitive Hashing) to find the most similar documents (nearest neighbors) of the given document.

This software is written by Python 2.x with LDA Model provided by gensim and LSHForest provided by scikit-learn

2. Installation

This software depends on NumPy, Scikit-learn, Gensim - Python packages for scientific computing. You must have them installed prior to using vnSRL.

The simple way to install them is using pip:

	# pip install -U numpy scikit-learn gensim

3. Usage

3.1 Data

This software requires 2 data files for training:

  • Input data file includes documents in database. Each document is written on each line.
  • Stop words file includes stop words which are are filtered out before processing data.

And for query, we need 1 file stored given documents.

To run demo, can download sample input files. Those are extracted from eva.vn provided by Rich Anchor Team:

3.2 Quick-start

You can use this software by the following command-line:

python main.py

You can modify source code to fit your data:

  • main.py:
    • input_file: path to input data file
    • stopwords_file: path to stop words file
    • num_topics: number of topics in LDA Model
    • prefix_name: prefix name of saved files (dictionary, corpus, model, etc.)
    • directory: path to saved data directory
    • query: path to query file
  • setting.py: stores default setting
  • corpus.py:
    • get_docs(): modify to fit data format

4. References

5. Contact

Xuan-Khoai Pham [email protected]

document-similarity's People

Contributors

khoaipx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

document-similarity's Issues

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.