Code Monkey home page Code Monkey logo

pydsm's Introduction

PyDSM

PyDSM is a lightweight Python 3 framework for building and exploring distributional semantic models with focus on extensibility and ease of use. While mostly developed as a personal project, I hope it could still be found useful for others.

Building a DSM with PyDSM is easy:

In [1]: import pydsm, plainstream

In [2]: wikitext = plainstream.get_text(language='en', max_words=1000, tokenize=True)

In [3]: cooc = pydsm.build(pydsm.CooccurrenceDSM, window_size=(2,2), corpus=wikitext, lower_threshold=3)
Building collocation matrix from corpus....
Total time: 1.75 s

In [4]: cooc
Out[4]:
CooccurrenceDSM
Vocab size: 445
[61, 61]  a    been  the  ...
that      0.0  0.0   2.0  ...
some      0.0  0.0   0.0  ...
''        1.0  0.0   2.0  ...
...       ...  ...   ...  ...

Please see the tutorial for a quick introduction of the package.

Features

  • Build distributional semantic models from text corpora (Cooccurrence matrix and Random Indexing models included).
  • Find nearest neighbors using common similarity measures.
  • Apply common weighting techniques, such as positive pointwise mutual information.
  • Simple DSM visualizations.

Installation

Download the package, and type:

$ python setup.py install

The package is only tested on python 3.4.

Requirements

Please make sure you have Cython installed.

Acknowledgements

A lot of inspiration comes from the DISSECT toolkit, a part of the COMPOSES project. Many headaches were avoided from inspecting their work.

pydsm's People

Contributors

jimmycallin avatar

Watchers

José Manuel Martínez Martínez 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.