- Installation
Clone this repository and install requirements
git clone https://github.com/nicklogin/DistractorSelector
python -m pip install -r requirements.txt
python -m nltk.downloader punkt
- Installation via Docker
You can install DistractorSelector image from Dockerhub:
docker pull niklogin/disselector:latest
You can also build a Docker image from source after cloning this repository:
docker build . -t disselector:latest
- Usage via terminal/command line
DistractorSelector accepts a CSV file with sentences as an input and outputs a CSV file with distractors.
The input file must contian the following fields (example - gold_standard/gold_standard_input.csv):
Masked sentence - The sentence where the target word is replaces with [MASK] token
Right answer - The target word
Run this command to get output of DistractorSelector:
python -m distractor_generator --
DistractorSelector accepts the following set of CLI arguments:
Argument | Description | Default value |
--filename | Path to input file | gold_standard/gold_standard_input.csv |
--output_filename | Path to output file | data/gold_standard_output.csv |
--sep | Field delimiter in a CSV file | ; |
--index_col | The name of the index column in a CSV file | None |
--n | Number of distractors on the classifier input | 20 |
--no-clf | Do not use classifier | - |
--clf_path | Path to file with the saved classifier model | XGBAllFeats/clf.pkl |
--cols_path | Path to file with feature names to be used with the classifier | XGBAllFeats/cols.json |
- Usage via a WebAPI
Execute this command in command line/terminal to run the API of DistractorSelector:
python -m api
The documentation will be available at http://localhost:5000/docs