<commit_before># The context2vec toolkit

With this code you can:
* Use our pre-trained models to represent sentential contexts of target words and target words themselves with low-dimensional vector representations.
* Learn your own context2vec models with your choice of a learning corpus and hyperparameters.

Please cite the following paper if using the code:

**context2vec: Learning Generic Context Embedding with Bidirectional LSTM**  
<NAME>, <NAME>, <NAME>. CoNLL, 2016 [[pdf]](http://u.cs.biu.ac.il/~melamuo/publications/context2vec_conll16.pdf).

## Requirements

* Python 2.7
* Chainer 1.7 ([chainer](http://chainer.org/))
* NLTK 3.0 ([NLTK](http://www.nltk.org/))  - optional (only required for the AWE baseline and MSCC evaluation)

## Installation

* Download the code
* ```python setup.py install```

## Quick-start

* Download pre-trained context2vec models from [[here]](http://u.cs.biu.ac.il/~nlp/resources/downloads/context2vec/)
* Unzip a model into MODEL_DIR
* Run:
```
python context2vec/eval/explore_context2vec.py MODEL_DIR/MODEL_NAME.params
>> this is a [] book
```
* This will embed the entire sentential context 'this is a \_\_ book' and will output the top-10 target words whose embeddings are closest to that of the context.
* Use this as sample code to help you integrate context2vec into your own application.

## Training a new context2vec model<commit_msg>Updated README with new python & chainer versions.<commit_after># The context2vec toolkit

With this code you can:
* Use our pre-trained models to represent sentential contexts of target words and target words themselves with low-dimensional vector representations.
* Learn your own context2vec models with your choice of a learning corpus and hyperparameters.

Please cite the following paper if using the code:

**context2vec: Learning Generic Context Embedding with Bidirectional LSTM**  
<NAME>, <NAME>, <NAME>. CoNLL, 2016 [[pdf]](http://u.cs.biu.ac.il/~melamuo/publications/context2vec_conll16.pdf).

## Requirements

* Python 3.6
* Chainer 4.2 ([chainer](http://chainer.org/))
* NLTK 3.0 ([NLTK](http://www.nltk.org/))  - optional (only required for the AWE baseline and MSCC evaluation)

## Installation

* Download the code
* ```python setup.py install```

## Quick-start

* Download pre-trained context2vec models from [[here]](http://u.cs.biu.ac.il/~nlp/resources/downloads/context2vec/)
* Unzip a model into MODEL_DIR
* Run:
```
python context2vec/eval/explore_context2vec.py MODEL_DIR/MODEL_NAME.params
>> this is a [] book
```
* This will embed the entire sentential context 'this is a \_\_ book' and will output the top-10 target words whose embeddings are closest to that of the context.
* Use this as sample code to help you integrate context2vec into your own application.

## Training a new context2vec model
{'fraction_non_alphanumeric': 0.10294639687610933, 'fraction_numerical': 0.01703940362087327, 'mean_word_length': 4.670020120724346, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4453015', 'n_tokens_mistral': 880, 'n_tokens_neox': 829, 'n_words': 319}