Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some improvements #5

Merged
merged 4 commits into from
Nov 14, 2021
Merged

Conversation

olivier-compilatio
Copy link
Contributor

Hi,
After reading the paper, I wanted to try the software. I like the idea of using WE vectors instead of just creating vectors from the yet-to-summarize text.
It didn't work at first so I dug into the code and made some changes :
1 : the stopword remover wasn't working : stopword_remover.add_keyword(stopword, "") makes it replace stopword by itself, because "" is understood as none. I just did a quick fix but it works.
2 : In centroid_word_embeddings.py , the word_vector_cache were bugged : the dictionary in the first if was new, so empty, and the condition was never entered. I modified the dict with the embedding model dict.
3 : I updated the load_gensim_embedding_model function. Seems the loading is simpler now than it was when you wrote the code!
I hope those fixes will help you,
Olivier

@A-Gulati
Copy link

Hi Oliver, any chance you could show me how to run the model on a sample subset of documents? I'm trying to work everything out!

@olivier-compilatio
Copy link
Contributor Author

It's quite simple, here is a python script you can try and modify.
`from text_summarizer.centroid_word_embeddings import CentroidWordEmbeddingsSummarizer
from text_summarizer.centroid_word_embeddings import load_gensim_embedding_model
import gensim.downloader as api

api.info() # show info about available models/datasets
model = api.load("glove-wiki-gigaword-300")

cwes = CentroidWordEmbeddingsSummarizer(
model, debug=True, bow_param=2, length_param=5, position_param=4
)
with open("sample.txt") as f:
text = f.read().replace("\n", " ")
cwes.summarize(text)
`

@A-Gulati
Copy link

After installing some dependencies, this worked. Thanks Oliver!

@blazejdolicki
Copy link

Oh I wish I read this merge request before trying out the repo, instead of spending a few hours to fix the same bugs you solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants