Aurelius84 / AoAKeyword

Keywords Extractor by Attention over Attention with POS Mask Matrix.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AoAKWExtractor

image

Keywords Extractor by Attention over Attention with POS Mask Matrix.

Requirements

  • pytorch
  • tensorboard
  • numpy
  • flask
  • gevent

Train model

# install virtualenv
python3 -m venv ENV3.6
# activate env
source ENV3.6/bin/activate

python train.py

# tensorboard log
tensorboard --logdir=/runs --port 8089

# open your browser and visit
http://127.0.0.1:8089

API

# start flask service with gevent in ENV
nohup python service.py &

# use Postman (chrome plugin) to visit:
http://127.0.0.1:5000/keywords

# if you just want to test, please visit:
http://10.232.22.243:5000/keywords

# only support post with form data
# make sure that form data as followed:
{
    "title": "This is a title", (required)
    "doc": "This is doc string" (required)
}

# response data
{
    "status": 200,
    "data":
    {
        "pre_kws":{
            "keyword1": prob1,
            "keyword2": prob2,
            "keyword3": prob3
        }
    }
}

What's Next

  • fine-tune model
  • more corpus to train

About

Keywords Extractor by Attention over Attention with POS Mask Matrix.


Languages

Language:Python 100.0%