MaartenGr / KeyBERT

Minimal keyword extraction with BERT
https://MaartenGr.github.io/KeyBERT/
MIT License
3.58k stars 357 forks source link

still running but there is no output #90

Closed Messimeimei closed 2 years ago

Messimeimei commented 2 years ago

when i am doing "kw_model = KeyBERT()",it was just still running but there was no output,what should i do to solve this problem image

Messimeimei commented 2 years ago

image

the same result when running in the cmd

MaartenGr commented 2 years ago

The code from the first two is difficult to view as it seems that the borders from the images are cut a bit short. Having said that, I would advise starting from a completely fresh environment and seeing if it works there. Also, make sure to update to the latest version of KeyBERT as older versions might use deprecated models.

Messimeimei commented 2 years ago

Well, I just used pip to check my version of keybert and found it was the newest,so maybe I should try a completely fresh environment,but I want to know whether a fresh environment means a new IDE??? Because I previously used the IDE (python 3.7 64 bit). If so, can I change it into VScode or VS? Thank you very much!!!

MaartenGr commented 2 years ago

A fresh environment means that you use a python install that has no packages installed other than what comes with python. Typically, users use pyenv or conda to manage their environments in order to make sure there are no conflicts with dependencies. I would advise starting with conda as you can quickly set it up without too much hassle.

Messimeimei commented 2 years ago

This time I installed miniconda and created a virtural environment of python 3.8,and used pip to install the latest version of keybert.

image But when I tried to run it, it still didn't work. Just the same as before,still running but there is no output.

image

I am a greenhand in this area, but I really want to make it work because I am helping my teacher doing a project,and I want to compare the keybert with traditional textrank to see which one's effect is better. So I will be very grateful if you are so kind to help me find the reason.

MaartenGr commented 2 years ago

Hmmm, when you are instantiating KeyBERT it is typically trying to download a sentence-transformer model. Do you have an active internet connection and sufficient space (a few hundred MBs) available? It might be interesting to run your command not in the command line but in a jupyter notebook as it typically gives a bit more information about the process. Lastly, you could also try it out in a Google colab or Kaggle notebook instance if there are no data privacy concerns.

allmin commented 2 years ago

The doc should be a list of sentences Eg. doc = ['Supervised learning is the machine learning task...', 'It infers a ...']

you can do this programmatically by using doc = doc.split('.') or you could use any standard NLP library to extract sentence Eg: NLTK

MaartenGr commented 2 years ago

Due to inactivity, I'll be closing this issue. However, if you are experiencing this issue still, I'll make sure to reopen the issue and we can discuss it further.

Messimeimei commented 2 years ago

Hey! I'm back to say thank you! Now I have learned more about python and relevent area. This time I also need to use keybert to finish my task, but I can handle everything! Thank you for providing such a nice tool for us! Thank you!

MaartenGr commented 2 years ago

Glad to hear that it worked out and thank you for your kind words! If you every run into any issues or if you have any suggestions, please let me know 😄