Comments (5)
The shape of word_embeddings is different with keywords.
That's correct and intended behavior! The reason why they differ is that .extract_embeddings
extracts the embeddings from all words in the documents. These are then fed to .extract_keywords
to extract a subset of words that will serve as keywords.
As such, if you want the embeddings of the keywords, you would have to generate them yourself.
from keybert.
How do I match the keywords to the vectors in word_embeddings? word_embeddings doesn't contain a vector of all words, I'm guessing it's stop words are removed. This results in me not being able to locate the corresponding vectors in word_embeddings based on the order of the keywords in the sentence. This is the point.
from keybert.
I had to use Sentence-Bert to embed the keyword because I see it used at the bottom of your code. Does this approach make sense? After all, to my knowledge, Sentence-Bert embeds sentences, not words.
from keybert.
I had to use Sentence-Bert to embed the keyword because I see it used at the bottom of your code. Does this approach make sense? After all, to my knowledge, Sentence-Bert embeds sentences, not words.
It does. Let me start by saying that sentence-transformers is not a single model but a framework that can use different models. In practice, although these models do generate embeddings for sentences/paragraphs that does not mean it cannot or should not embed words. These types of models often generate contextual word/token embeddings and sometimes do a simple procedure like averaging the token embeddings. As such, it can definitely generate word embeddings and it does so quite well.
from keybert.
Thank you MaartenGr, you solved my problem!
from keybert.
Related Issues (20)
- Extract keywords from multiple documents given a nested list of candidates for each document. HOT 1
- can't import keybert HOT 9
- Using KeyBERT with a locally saved model HOT 1
- Not able to use gensim HOT 5
- Why and how the same model for doc_embeddings and word_embeddings? HOT 1
- Setup check. Script to get keywords for comparing against SimpleMaths, TextRank and Philology results HOT 5
- Add more LLMs HOT 1
- OSError: libcudart.so.12: cannot open shared object file: No such file or directory HOT 2
- KeyLLM error: AttributeError: 'str' object has no attribute 'completions' HOT 9
- KeyLLM Error: AttributeError: 'CompletionChoice' object has no attribute 'message' HOT 6
- CLI tool like YAKE
- keybert benchmarks with respect to other phrase extraction techniques. HOT 1
- Drop support for Python < 3.8 HOT 5
- pre-commit-hooks: replace black and flake8 HOT 2
- OpenAi api HOT 4
- max token with openAI HOT 1
- fine tine modek HOT 1
- Getting TypeError: OpenAI.__init__() missing 1 required positional argument: 'client' because older version of openai being used
- Getting TypeError: OpenAI.__init__() missing 1 required positional argument: 'client' because older version of openai being used #242 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keybert.