Giter Site home page Giter Site logo

idiom_detection's Introduction

idiom_detection

Using natural language processing to detect English idioms in documents.

Link to this repo: https://github.com/drussotto/idiom_detection

Building the datasets

All data files are already loaded into this repo in the data/ folder. To generate the data from scratch, follow these steps:

  1. Run idiom_scraper.py to create the list of idioms (data/idioms.txt)

  2. Run idiom_example.py to retrieve the example sentences of idioms (data/idiom_example.csv)

  3. Run tag_*.py (brown, gutenberg, reuters, example) to generate sentences where idioms are tagged (e.g. rank#BEGIN and#IN file#IN)

  4. Run build_train_test.py to convert the sentences from the text files into pickle files containing the lists of sentences. [List-of [List-of (word, POStag, idiomTag)]]

Preparing to Model

The following steps are necessary to perform, as they create files needed for modeling that are too large to be stored on github.

  1. Get Google's pretrained Word2Vec file here https://drive.google.com/file/d/0B7XkCwpI5KDYNlNUTTlSS21pQmM/edit. Unzip the .gz file and save it in the data/ folder.

  2. Run create_n_grams_freq.py to create pickle files that contain the frequencies of unigrams and bigrams in the train and test data.

The Modeling Process

  • "Model Testing.ipynb" contains a "grid search" of different possible combinations of using Word2Vec similarity scores, PMI/PPMI similarity scores, and how many words ahead and behind to look at.

  • hyperparameter_tuning.py does a formal randomized grid search to see what the "best" regularization terms are.

  • regularization.py performs more intense regularization in an attempt to drive overly specific features down to zero (the result is never predicting the presence of an idiom)

idiom_detection's People

Contributors

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