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
Release files for retfidf 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| retfidf-0.0.2.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| retfidf-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / retfidf-0.0.2.tar.gz
| Download URL | retfidf-0.0.2.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d7a0c2cdcc4c1954207d17e189acbb32f75eb3eca60c77d13222734400ca919
|
|
BLAKE2b-256 checksum How to use checksums |
177009b3830a42ac87e8078d04d9184157aa9846c4c8afb01bc12b2575643ecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.5
|
Release files / retfidf-0.0.2-py3-none-any.whl
| Download URL | retfidf-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e397b66c1ea181355e83144d7c806ecd5f1533efcd7a1dbd7b545051be65576c
|
|
BLAKE2b-256 checksum How to use checksums |
e46f26797696545e21be89daab41becd6028524541f79ca312aae04309ee305b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.5
|