Skip to main content

This package provides a simple method to retrieve documents from large text corpora. For use in social sciences.

Project description

Document retrieval for social sciences

This package provides a simple method to retrieve documents from large text corpora. For use in social sciences.
It accompanies the paper [Finding democracy in big data: document retrieval using word-embedding] and is an
implementation of the algorithm described in the paper.

Manual

To create tfidf metrics, first pass the documents in list form to the class DocumentRetrieval at initialization.
You can either pass a created word2vec model to the class, or let the algorithm train word embeddings for you.
Then use the function calculate_similarity() with a keyword fo your choice to calculate the similarity between
the documents and the query. This function will return a list of scores for each of the documents passed to the
class at initialization.

You can use a multiple words query by simply passing it in a string format to the calculate_similarity() function.

Proposed usage:

from retfidf import doc_retrieval

df = pd.read_csv('corpus.csv')

emb_sim = doc_retrieval(df['text'])

query = 'democracy'

df['democracy_metrics'] = emb_sim.calculate_similarity(query)  

GITHUB

https://github.com/hplisiecki/document-retrieval-for-social-sciences

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

retfidf-0.0.2.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

retfidf-0.0.2-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page