Skip to main content

ELFEN - Efficient Linguistic Feature Extraction for Natural Language Datasets

This Python package provides efficient linguistic feature extraction for text datasets (i.e. datasets with N text instances, in a tabular structure).

For further information, check the GitHub repository and the documentation

Using spacy models

If you want to use the spacy backbone, you will need to download the respective model, e.g. "en_core_web_sm":

python -m spacy download en_core_web_sm

Usage of third-party resources usable in this package

For the full functionality, some external resources are necessary. While most of them are downloaded and located automatically, some have to be loaded manually.

WordNet features

To use wordnet features, download open multilingual wordnet using:

python -m wn download omw:1.4

Note that for some languages, you will need to install another wordnet collection. For example, for German, you can use the following command:

python -m wn download odenet:1.4

For more information on the available wordnet collections, consult the wn package documentation.

Note that if you have used elfen or the wn package before, you may encounter errors from the wn package about an incompatible database schema. In that case, you can use the following command to reset the database:

  import wn
  wn.reset_database(rebuild=True)

Emotion lexicons

The emotion lexicons used in this package have to be downloaded manually due to licensing restrictions. After downloading, the extracted folders have to be placed in the respective directories.

To do so, download the intensity lexicons from the NRC Emotion Intensity Lexicon page, the association lexicons from the NRC Emotion Association Lexicon page and the vad lexicons from the NRC VAD Lexicon page. Note that for the VAD lexicon, you will have to use the version 1. The newer version 2.1 is not integrated in elfen yet.

To use them in elfen, find the elfen_resources directory in your local elfen installation (for example with pip):

python -m pip show elfen

Then, the elfen_resources directory should be located in the same directory as the elfen package directory.

Create the following subdirectories if they do not exist yet:

  • elfen_resources/Emotion/Sentiment
  • elfen_resources/Emotion/VAD
  • elfen_resources/Emotion/Intensity

Then, place the downloaded extracted zip folders in the respective directories:

  • Place the extracted zip folder of the NRC Emotion Intensity Lexicon in elfen_resources/Emotion/Intensity/
  • Place the extracted zip folder of the NRC Emotion Association Lexicon in elfen_resources/Emotion/Sentiment/
  • Place the extracted zip folder of the NRC VAD Lexicon in elfen_resources/Emotion/VAD/

Licences of lexicons

The extraction of psycholinguistic, emotion/lexicon and semantic features relies on third-party resources such as lexicons. Please refer to the original author's licenses and conditions for usage, and cite them if you use the resources through this package in your analyses.

For an overview which features use which resource, and how to export all third-party resource references in a bibtex string, consult the documentation.

Multiprocessing and limiting the numbers of cores used

The underlying dataframe library, polars, uses all available cores by default. If you are working on a shared server, you may want to consider limiting the resources available to polars. To do that, you will have to set the POLARS_MAX_THREADS variable in your shell, e.g.:

export POLARS_MAX_THREADS=8

Acknowledgements

While all feature extraction functions in this package are written from scratch, the choice of features in the readability and lexical richness feature areas (partially) follows the readability and lexicalrichness Python packages.

We use the wn Python package to extract Open Multilingual Wordnet synsets.

Citation

If you use this package in your work, for now, please cite

@misc{maurer-2025-elfen,
  author = {Maurer, Maximilian},
  title = {ELFEN - Efficient Linguistic Feature Extraction for Natural Language Datasets},
  year = {2025},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/mmmaurer/elfen}},
}

Metadata

Release files for elfen 1.3.4

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

Source distribution (sdist)

Source distribution for elfen 1.3.4
File Size Uploaded
elfen-1.3.4.tar.gz 61.9 kB Details

Built distribution (wheel)

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

Total release size: 127.3 kB

Release files / elfen-1.3.4.tar.gz

Download URL elfen-1.3.4.tar.gz
Size 61.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e1c679a469c5cda58ccf55bf91000c4f776258b796561bf24bde4a983539f334
BLAKE2b-256 checksum
How to use checksums
d0a573c37c642162de5dce520cd01da4a3b06537ae545413d8d3c2d6f7bf3a38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / elfen-1.3.4-py3-none-any.whl

Download URL elfen-1.3.4-py3-none-any.whl
Size 65.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcde0bd2eacaa36096295d5e89369b63a5e42bdb175537777dc5d1c2e5d38f6a
BLAKE2b-256 checksum
How to use checksums
5eb4f50d4fc27b08ba69f37c4152b0172e61cf8d231498b9672cecf804411719
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release history Release notifications | RSS feed

1.3.5

2 release files

This release

1.3.4 This release

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

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