Skip to main content

gdelt-regkg

CI PyPI Python License DOI

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

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 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 record generation for metadata, overrides and export behavior.

Documentation

Topic Documentation
Start here Documentation index and quickstart
Python interfaces API reference
Field formats and limitations All 27 GKG fields
Dictionaries and configuration Resource guide
Non-English articles Translation guide
Command-line tools CLI reference and benchmark guide
Accuracy and interpretation Results and methodology
Upgrading Migration guide and changelog

Contributing

See Contributing for project architecture, local checks and evaluation requirements. Use the GitHub issue forms for bugs, features and extraction differences. Follow the code of conduct; report vulnerabilities through the security policy.

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.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 gdelt-regkg 2.1.0
File Size Uploaded Provenance Actions
gdelt_regkg-2.1.0.tar.gz 590.8 kB With provenance Details for gdelt_regkg-2.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.0 MB

Release files / gdelt_regkg-2.1.0.tar.gz

Download URL gdelt_regkg-2.1.0.tar.gz
Size 590.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c818afbe9d1f8474c010955c88300f1410cd34cc24a95c50d574e93d27fd520a
BLAKE2b-256 checksum
How to use checksums
bbaa138cc87e64bfb7411cef11d184339fbd692a760f070cb584f59f84907a1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 16, 2026.

Transparency log

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

Download URL gdelt_regkg-2.1.0-py3-none-any.whl
Size 448.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
569d34e81664c824af83694f247591351cedd7955bab92ef72b05361a6a71373
BLAKE2b-256 checksum
How to use checksums
3243be6e7e6c722c2d0986fdc76d98292d4d0e4849ee5c5fbc68fb0a60541e36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 16, 2026.

Transparency log

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

Full provenance

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

Select from 2 files

Attestation for gdelt_regkg-2.1.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 16, 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