Code Monkey home page Code Monkey logo

ddr's Introduction

DDR

This repository contains an updated implementation of the distributed dictionary representation (DDR) algorithm, which returns an estimation of the semantic similarity between a set of documents and latent constructs (seed words/dictionary).

Background

The DDR algorithm was first introduced by Garten 2018, Dictionaries and distributions: Combining expert knowledge and large scale textual data content analysis : Distributed dictionary representation. The original implementation can be found here.

The implementation in this repository is based on the original implementation, but has been modified to work with other types of pretrained embeddings (GloVe, FastText, Word2vec) and Python 3. Instead of the original split() method, nltk word tokenization method (word_tokenize()) is used to tokenize input documents.

Installation Guidelines

(Adopted from the original repository)

Currently, this package requires an installation of python 3, as well as the following dependencies:

numpy
nltk
pandas
gensim

To install these dependencies, you can use the following command: pip install -r requirements.txt

Usage

To start, you should create a data folder to store all the necessary files for the DDR algorithm. In the data folder, there should be 3 subdirectories: dictionary, document and output.

  • dictionary should store .txt files that contain the seed words. Each dictionary dimension is represented by a separate text file and each text file contains the seed terms for that dimension (separated by whitespace).
  • document should store a .txt file that contain all documents (one document for each line).
  • output should be the destination directory storing the result of the DDR algorithm.

Once you've set up the necessary folders and datasets, run the code stored in run.sh. You will need to modify the data paths and activate your virtual environment (optional) to match your setup. Then, assuming you are inside the DDR folder, run the script with sh run.sh. This script will store files containing document and concept representation, missing words, and final loadings in the designated output directory.

Reference

Garten J, Hoover J, Johnson KM, Boghrati R, Iskiwitch C, Dehghani M. Dictionaries and distributions: Combining expert knowledge and large scale textual data content analysis : Distributed dictionary representation. Behav Res Methods. 2018 Feb;50(1):344-361. doi: 10.3758/s13428-017-0875-9. PMID: 28364281.

ddr's People

Contributors

chtmp223 avatar

Watchers

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