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.

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

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.

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.2

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.2
File Size Uploaded Provenance Actions
gdelt_regkg-2.1.2.tar.gz 624.3 kB With provenance Details for gdelt_regkg-2.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / gdelt_regkg-2.1.2.tar.gz

Download URL gdelt_regkg-2.1.2.tar.gz
Size 624.3 kB
Tags Source
SHA-256 checksum
How to use checksums
65a0e4d699b560ff22fcb96923f69580a21aab928c540fa947ad328b3992fd6d
BLAKE2b-256 checksum
How to use checksums
c4ac1525da5819003fde9998df31855061060d2816cd47304edd950cd0d226ce
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 20, 2026.

Transparency log

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

Download URL gdelt_regkg-2.1.2-py3-none-any.whl
Size 461.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00eb5baad24ad98fac829efcd6df0d59bf2c9431b2b291497f94f799642ca4c2
BLAKE2b-256 checksum
How to use checksums
b09d0d797d987df1e1915c44e76a398b4fead973dc80e7975580bda1cbb1a97d
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 20, 2026.

Transparency log

Security for gdelt-regkg 2.1.2

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.2.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 20, 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