Skip to main content

A forked emfd from emfdscore

Improvements

  • compatible with latest spacy and pandas package

  • score_docs using column index for scoring

  • original one: emfdscore

eMFDscore: Extended Moral Foundation Dictionary Scoring for Python

made-with-python Open Source Love png2

emfd is a library for the fast and flexible extraction of various moral information metrics from textual input data. emfd is built on spaCy for faster execution and performs minimal preprocessing consisting of tokenization, syntactic dependency parsing, lower-casing, and stopword/punctuation/whitespace removal. eMFDscore lets users score documents with multiple Moral Foundations Dictionaries, provides various metrics for analyzing moral information, and extracts moral patient, agent, and attribute words related to entities.

When using eMFDscore, please consider giving this repository a star (top right corner) and citing the following article:
Hopp, F. R., Fisher, J. T., Cornell, D., Huskey, R., & Weber, R. (2020). The extended Moral Foundations Dictionary (eMFD): Development and applications of a crowd-sourced approach to extracting moral intuitions from text. Behavior Research Methods, https://doi.org/10.3758/s13428-020-01433-0

eMFDscore is dual-licensed under GNU GENERAL PUBLIC LICENSE 3.0, which permits the non-commercial use, distribution, and modification of the eMFDscore package. Commercial use of the eMFDscore requires an application.

Before install

install spacy and en_core_web_sm

Install

pip install emfd

Usage

  • emfd
import pandas as pd
from emfdscore.scoring import score_docs
df = pd.read_csv("your_data_set.csv")
num_docs = len(df)
DICT_TYPE = 'emfd'
PROB_MAP = 'all' # or single
SCORE_METHOD = 'bow' # or more options
OUT_METRICS = 'sentiment' # or vice-virtue
OUT_CSV_PATH = './your_output.csv'
df = score_docs(df,DICT_TYPE,PROB_MAP,SCORE_METHOD,OUT_METRICS,num_docs)
df.to_csv(OUT_CSV_PATH, index=False)

Future

  • polars implementations
  • vectorized operations

eMFDscore in Google Colaboratory

eMFDscore can also be run in google colab. All you need to do is add these lines to the beginning of your notebook, execute them, and then restart your runtime:

!pip install -U pip setuptools wheel
!pip install -U spacy
!python -m spacy download en_core_web_sm
!pip install emfd

Usage

Applications

The eMFD has been used in the following applications (ordered by date of publication):

Metadata

Release files for emfd 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emfd 0.1.0
File Size Uploaded Provenance Actions
emfd-0.1.0.tar.gz 6.2 MB Without provenance Details for emfd-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for emfd 0.1.0
File Interpreter ABI Platform Actions
emfd-0.1.0-py3-none-any.whl Python 3 none any Details for emfd-0.1.0-py3-none-any.whl

Total release size: 12.4 MB

Release files / emfd-0.1.0.tar.gz

Download URL emfd-0.1.0.tar.gz
Size 6.2 MB
Tags Source
SHA-256 checksum
How to use checksums
47c4bbaae9c5e77a80e6244909920cb0a5f546f9460f07ba03d6df4c4db75fa1
BLAKE2b-256 checksum
How to use checksums
b61a850be887564d6e3e97bc23a9990e8535d5b3ac7239ae1496d4384d9a2353
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.1 Darwin/22.4.0

Release files / emfd-0.1.0-py3-none-any.whl

Download URL emfd-0.1.0-py3-none-any.whl
Size 6.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6c23e4dba6f456807caa47f46a0535efd439e873d615683d65e10514987908fd
BLAKE2b-256 checksum
How to use checksums
39002cee3260e60b9812332abdeec3b24d796b02f7abd553f279acd4f41e1423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.1 Darwin/22.4.0

Security for emfd 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page