Skip to main content

gdelt-regkg

CI PyPI Python License DOI arXiv

Reconstruct GDELT GKG records from prepared article text and supplied metadata. Generate complete 27-column records or analyze individual fields from Python.

Documentation · Installation and setup · Quickstart · GKG field reference

You can use gdelt-regkg to:

  • Process your own news datasets into GKG-compatible records.
  • Extract individual fields, such as themes, tone, entities or event counts, for analysis.
  • Reconstruct gaps in GKG coverage from available article bodies and metadata.
  • Analyze multilingual articles.
  • Evaluate custom dictionaries and extraction profiles.
  • Compare reconstructed fields with archived GKG output using the benchmark tools.

Installation

Requires Python 3.12 or newer. For English record generation:

python -m pip install "gdelt-regkg[ner]"
python -m spacy download en_core_web_sm
gdelt-regkg-cli build all --sources-dir downloads/resources --download-sources --output local-resources

See Installation and setup for optional dependencies, translation and CPU/CUDA setup. External dictionaries and models are prepared locally and retain their own source terms.

Usage

The library supports processing fields either individually:

from gdelt_regkg.fields.counts import analyze_counts
from gdelt_regkg.fields.themes import analyze_themes
from gdelt_regkg.fields.tone import analyze_tone

text = "Flooding killed 12 people."
counts = analyze_counts(text)
print(counts.to_gkg())
print(counts.to_gkg(enhanced=True))
print(analyze_themes(text).to_gkg())
print(analyze_tone(text).to_gkg())
CRISISLEX_T03_DEAD#12#people#0######;KILL#12#people#0######;
CRISISLEX_T03_DEAD#12#people#0#######16;KILL#12#people#0#######16;
CRISISLEX_C06_WATER_SANITATION;NATURAL_DISASTER_FLOODING;CRISISLEX_T03_DEAD;KILL;
-25,0,25,25,25,0,4

or all at once:

from gdelt_regkg import RecordMetadata, Resources, generate_gkg, write_gkg
from gdelt_regkg.fields.ner import SpacyNER

text = "Flooding killed 12 people in London."
metadata = RecordMetadata(
    identifier="https://example.org/story",
    batch_time="20261001091500",
    sequence=1,
    sharing_image="",
    related_images=[],
    social_image_embeds=[],
    social_video_embeds=[],
    extras={},
)
resources = Resources(
    resources_dir="local-resources",
    recognizer=SpacyNER.from_model("en_core_web_sm"),
)
record = generate_gkg(text, metadata, resources, strict=True)
with open("articles.gkg.tsv", "w", encoding="utf-8", newline="") as stream:
    write_gkg([record], stream)

articles.gkg.tsv contains one complete, headerless GKG row. Run from the directory containing local-resources/ prepared by gdelt-regkg-cli build.

See Quickstart for standalone field extraction and Generate records for metadata, overrides and export behavior.

Documentation

Topic Documentation
Start here Home and Quickstart
Field formats and limitations GKG field reference
Dictionaries and configuration Build resources
Dictionary presets and custom inventories Build GCAM resources
Geographic reference lookups Build gazetteers
Non-English articles Translation
Command-line tools CLI and Benchmarking
Accuracy and interpretation Results and Methodology
Upgrading Migration and changelog

Citation

If you use this package in research, cite the software release on Zenodo. See Citing the software for BibTeX and CITATION.cff for machine-readable metadata. Cite the dictionary resources used in your analysis separately.

For the field-level agreement evaluation, cite Nikita A. Klimin (2026), Agreement Between Reconstructed and Native GDELT GKG Records: A Field-Level Baseline. See Citing the agreement study for BibTeX.

Contributing

See Development setup for local checks and evaluation requirements, and Project structure for the source layout. Contributing covers issue reports, pull requests and external inputs. Follow the code of conduct; report vulnerabilities through the security policy.

Implementation tasks are listed under Future work.

License and disclaimer

This is an independent implementation, unaffiliated with and not endorsed by the GDELT Project. Reconstructed fields are approximate; results depend on article text, translation, models and dictionaries. Validate them for your intended analysis.

The code and original rules use the MIT license and are provided without warranty. External dictionaries, models, article bodies and derived profiles retain their source terms.

Metadata

Release files for gdelt-regkg 2.2.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 gdelt-regkg 2.2.0
File Size Uploaded Provenance Actions
gdelt_regkg-2.2.0.tar.gz 640.0 kB With provenance Details for gdelt_regkg-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gdelt-regkg 2.2.0
File Interpreter ABI Platform Actions
gdelt_regkg-2.2.0-py3-none-any.whl Python 3 none any Details for gdelt_regkg-2.2.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / gdelt_regkg-2.2.0.tar.gz

Download URL gdelt_regkg-2.2.0.tar.gz
Size 640.0 kB
Tags Source
SHA-256 checksum
How to use checksums
261791ec8e773976370131ef055af408f8a4b5966a2c02ea69ca9e110dedcd00
BLAKE2b-256 checksum
How to use checksums
6365450afeda1a1ec421720ba8fd244f5395b03ea83c631c2bc18a00ec4d7cd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / gdelt_regkg-2.2.0-py3-none-any.whl

Download URL gdelt_regkg-2.2.0-py3-none-any.whl
Size 464.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34846488b6859b6cab2b95ddb69e56b210f2461816d768825ba35dca7ad76ac1
BLAKE2b-256 checksum
How to use checksums
ef1b200b61f8aa7302542ed54ca723ec2e090a55b6a0dd03808a106199c996d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for gdelt-regkg 2.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gdelt_regkg-2.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

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.

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