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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d7a0c2cdcc4c1954207d17e189acbb32f75eb3eca60c77d13222734400ca919
|
|
| MD5 |
8e0ad4d13184950ce784d7f8413b34b6
|
|
| BLAKE2b-256 |
177009b3830a42ac87e8078d04d9184157aa9846c4c8afb01bc12b2575643ecf
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e397b66c1ea181355e83144d7c806ecd5f1533efcd7a1dbd7b545051be65576c
|
|
| MD5 |
1c73bc2de83435baa0b03209dfe6a96e
|
|
| BLAKE2b-256 |
e46f26797696545e21be89daab41becd6028524541f79ca312aae04309ee305b
|