GithubHelp home page GithubHelp logo

keyphrase-extraction's Introduction

Keyphrase extraction

Keyphrase extraction meant to extract meaningful attributes from fashion products. Python3 based. What implemented so far:

  • Graph based methods
  • Embedding based methods

TODO:

  • Remove meaningless but frequent words and rebuild the LDA model
  • Maybe try some DL supervised methods

Installation of dependencies

pip3 install -r requirements.txt
python -m nltk.downloader stopwords
python -m nltk.download('averaged_perceptron_tagger')

To enable the use of Embedding-based method, follow innstructions here to download Sent2vec model and store it in the 'EmbeddingRank' folder. Name it as 's2v.bin' for example.

Since I have already trained with LDA, I stored the word-to-topic distribution, document-to-topic distribution and feauture_names as pickle file inside LDA folder. Feel free to train with your own corpus using lda.py and replace them with your trained distributions.

Minimal example

After download the whole repo and named it as kkExtract:

# Example of single-tpr extraction
import kkExtract
# tpr_rank = kkExtract.graph_methods.singleTPR(doc_index = 12, str_input=test_str) # you need to specify the document index in the corpus, build from string
tpr_rank = singleTPR(doc_index = 12, input_file=path/to/your/txt_file) # build from txt file
tpr_rank.weight_node()
res = tpr_rank.get_top_phrases(k=6)
print(res)
# Example of EmbedRank extraction
path_to_sen2vecmodel = 's2v.bin'
emb_rank = EmbedRank(k=5, embedModel = path_to_sen2vecmodel)
emb_rank.load_text(test_str)
res = emb_rank.topK_phrase()

Detailed examples are provided in the end of each methods python file

Currently implements the following keyphrase extraction models:

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.