/MedNLP

Mandarin Medical Dialogue Analysis with Pytorch.

Primary LanguagePythonMIT LicenseMIT

MedNLP

🏥 📖 Mandarin medical dialogue analysis implemented in PyTorch.

Introduction

This is a repository for analyzing mandarin medical dialgoues, including risk assessment and multiple-choice questing answering. The codes are designed for the Medical Dialog Analysis Competition. To reproduce our results, please refer to the reproduce section.

Instructions

Installation

  • Python 3.6+
pip install -r requirement.txt

Download Data

vim aidea-web.tw_cookies.txt # put log-in cookies.txt here
./download.sh

Reproduce

bash reproduce.sh config/risk_test.yaml config/qa_test.yaml

Risk Assessment

Model

See report.pdf

Train Masked Language Model (MLM)

vim config/mlm.yaml # Set train path and pretrained model.
bash train_mlm.sh

Train Risk Model (DL-based)

vim config/risk.yaml # Put your pretrained MLM here. Set train path and test path.
bash train_risk.sh

Test (DL-based)

python src/train_risk.py --config config/risk.yaml --mode test

Train & Test Risk Model (TF-IDF)

bash run_risk_tfidf.sh

Question Answering

Model

See report.pdf

Test

bash run_qa_rule_base.sh