Coder Social home page Coder Social logo

cke-zh's Introduction

Unsupervised Keyphrase Extraction

This is code support chinese keyphrase extraction for EMNLP 2021 paper: Unsupervised Keyphrase Extraction by Jointly Modeling Local and Global Context.

This code support document length > 512.

requirements

  • transformers==4.7.0
  • nltk
  • pytorch
  • tqdm

We employ StanfordCoreNLP 4.5.1 to preprocess the data, you can download it here: https://stanfordnlp.github.io/CoreNLP/index.html.

We employ the chinese bert from https://huggingface.co/hfl/chinese-macbert-base/tree/main.

Runing

Step 0: tokenize and tag the plain text (one example/line).

python  src/data_preprocess.py [data_path] [file_name]

Step 1: obtain embeddings of candidate phrases and the whole document.

python src/get_embedding.py --file_path [data_path] --file_name [file_name] --model_name [pretrained model name/path]

Step 2: extract keyphrases

python src/ranker.py [data_path] [model_name]

cke-zh's People

Contributors

xnliang98 avatar

Stargazers

 avatar  avatar Yasutaka Odo avatar Chao SU avatar Jiong Yu avatar  avatar  avatar  avatar  avatar  avatar Challenging avatar

Watchers

James Cloos avatar  avatar

Forkers

ykkhds

cke-zh's Issues

code mistake

hello, mate, thanks for your excellent work ! there is a mistake in your code: you forget to add the rest of the input sentence to the tokens_sgements, maybe you should add tokens_sgements.append(tmp) after line 99 in src/get_embedding.py

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.