Giter VIP home page Giter VIP logo

cmtn's Introduction

This repository is the source code of paper: "A combined recall and rank framework with online negative sampling for Chinese procedure terminology normaliztion"

folders and files:

/data contains the raw data file used in this paper, which could be downloaded from http://openkg.cn/dataset/yidu-n7k.

/dict contains the keywords dictionary used for keywords attentive mechanism, in which body.txt includes procedure site words and ot.txt includes procedure type words.

rerank_k_fold_data contains the k-fold training data for keywords attentive ranker, which is generated by candidate generator.

/output contains the output results(such as saved model, middel output, caches for prediction), you should pass a output_name parameter each time you run the experiment.

We use the bert trained on Chinese corpus provided by google. You could change the defalut path in train.py and rerank_keywords.py by the arg parameter pretrained_model_path, you could also change it in the running command

train and evaluate

candidate generator

Train:

# k_fold_id range from [0, 4]
# device_id is used when you have multiple gpu, starts from 0 
python train.py -output_name={your_output_name} -k_fold={k_fold_id} -device={devicd_id} -pretrained_model_path={your_pretrained_model_path}


# if you don't want to use k-fold, just run:
python train.py -output_name={your_output_name} -device={device_id} -pretrained_model_path={your_pretrained_model_path}

After you run the following code, there should be a folder /output/mto_output/{your_output_name}. If you use k-fold, there should be 5 folders for each fold, to evaluate, just run:

python train.py -output_name={your_ourput_name}_test -type=evaluate -k_fold=0 -saved_model_path=./output/mto_output/{your_output_name} -generate_candidates=test -device={device_id} -pretrained_model_path={your_pretrained_model_path}

keywords attentive ranker

Train

python rerank_keywords.py -k_fold={k_fold_id} -output_name={your_output_name} -device={device_id} -pretrained_model_path={your_pretrained_model_path}

Evaluate

python rerank_keywords.py -type=evaluate -output_name={your_output_name}_test -saved_model_path=./output/rerank_keywords_output/{your_output_name} -generate_candidates=test -device=0 -k_fold=0

cmtn's People

Contributors

meloming avatar sxthunder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cmtn's Issues

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.