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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file retfidf-0.0.2.tar.gz.

File metadata

  • Download URL: retfidf-0.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for retfidf-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3d7a0c2cdcc4c1954207d17e189acbb32f75eb3eca60c77d13222734400ca919
MD5 8e0ad4d13184950ce784d7f8413b34b6
BLAKE2b-256 177009b3830a42ac87e8078d04d9184157aa9846c4c8afb01bc12b2575643ecf

See more details on using hashes here.

File details

Details for the file retfidf-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: retfidf-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for retfidf-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e397b66c1ea181355e83144d7c806ecd5f1533efcd7a1dbd7b545051be65576c
MD5 1c73bc2de83435baa0b03209dfe6a96e
BLAKE2b-256 e46f26797696545e21be89daab41becd6028524541f79ca312aae04309ee305b

See more details on using hashes here.

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