cstr's picture
Update README.md
4d3fd17 verified
---
license: cc-by-4.0
pretty_name: ConceptNet 5 (Normalized SQLite, Filtered)
language:
- en
- fr
- it
- de
- es
- ar
- fa
- grc
- he
- la
- hbo
multilinguality: multilingual
tags:
- conceptnet
- knowledge-graph
- sqlite
- normalized
---
# Normalized ConceptNet 5 (SQLite, Filtered)
This dataset contains a normalized, filtered, and optimized version of the ConceptNet 5.5 knowledge graph, ready for high-performance querying in a single SQLite file.
It is derived from the `cstr/conceptnet-de-indexed` dataset, which was a 23.6 GB un-normalized SQLite file containing 28.3 million nodes and 34 million edges.
This version has been processed to be significantly smaller, faster, and data-correct.
## Key Features
- **Normalized Schema**: The original 23.6 GB database stored massive text URLs (e.g., `http://conceptnet.io/c/en/dog`) in the 34M-row edge table. This version stores all 28M nodes in a `node_norm` lookup table and uses small, fast integer foreign keys (`start_fk`, `end_fk`) in the `edge_norm` table. This reduces the final database size by over 90%.
- **Targeted Language Filtering**: The 34 million edges have been filtered to keep only those relevant to a specific set of 11 languages: `en`, `fr`, `it`, `de`, `es`, `ar`, `fa`, `grc`, `he`, `la`, `hbo`.
- **Preserves Cross-Language Edges**: The filtering logic is data-safe. It keeps any edge where at least one of its nodes belongs to a target language. This is critical for preserving cross-lingual connections (e.g., a Japanese node `ja` linked to a German node `de`).
- **No Orphans**: The final `edge_norm` table links to the `node_norm` table. While `node_norm` contains all 28M original nodes (for lookup integrity), the `edge_norm` table only contains the filtered, relevant edges.
## Database Schema
This SQLite file (`conceptnet_normalized.db`) contains three tables:
### node_norm
- `node_pk` (INTEGER PRIMARY KEY): The new, unique integer ID for the node.
- `node_url` (TEXT UNIQUE NOT NULL): The original ConceptNet URL (e.g., `http://conceptnet.io/c/en/dog`).
- `language` (TEXT NOT NULL): The language code for the node (e.g., `en`, `de`), extracted from the source DB.
### rel_norm
- `rel_pk` (INTEGER PRIMARY KEY): The new, unique integer ID for the relation.
- `rel_url` (TEXT UNIQUE NOT NULL): The original relation URL (e.g., `http://conceptnet.io/r/IsA`).
### edge_norm
- `start_fk` (INTEGER NOT NULL): Foreign key to `node_norm.node_pk`.
- `end_fk` (INTEGER NOT NULL): Foreign key to `node_norm.node_pk`.
- `rel_fk` (INTEGER NOT NULL): Foreign key to `rel_norm.rel_pk`.
- `weight` (REAL NOT NULL): The edge weight.
## How to Use
You can query this database using any standard SQLite library.
```python
import sqlite3
import pandas as pd
DB_PATH = "conceptnet_normalized.db" # Or path from hf_hub_download
conn = sqlite3.connect(f"file:{DB_PATH}?mode=ro", uri=True)
# Example: Get the top 5 'IsA' relationships for 'dog'
query = """
SELECT
n_start.node_url AS start_node,
r.rel_url AS relation,
n_end.node_url AS end_node,
e.weight
FROM edge_norm e
JOIN node_norm n_start ON e.start_fk = n_start.node_pk
JOIN node_norm n_end ON e.end_fk = n_end.node_pk
JOIN rel_norm r ON e.rel_fk = r.rel_pk
WHERE
n_start.node_url = 'http://conceptnet.io/c/en/dog'
AND r.rel_url = 'http://conceptnet.io/r/IsA'
ORDER BY e.weight DESC
LIMIT 5;
"""
df = pd.read_sql_query(query, conn)
print(df)
conn.close()
```
## Original Dataset Description
- **Homepage**: https://github.com/commonsense/conceptnet5/wiki
- **Repository**: https://github.com/commonsense/conceptnet5/wiki
- **Paper**: https://arxiv.org/abs/1612.03975
ConceptNet is a multilingual knowledge base, representing words and phrases that people use and the common-sense relationships between them. The knowledge in ConceptNet is collected from a variety of resources, including crowd-sourced resources (such as Wiktionary and Open Mind Common Sense), games with a purpose (such as Verbosity and nadya.jp), and expert-created resources (such as WordNet and JMDict).
This dataset is derived from the `conceptnet5` dataset (also on the Hub) and the `cstr/conceptnet-de-indexed` repository.
## Licensing Information
This work includes data from ConceptNet 5, which was compiled by the Commonsense Computing Initiative. ConceptNet 5 is freely available under the Creative Commons Attribution-ShareAlike license (CC BY SA 4.0) from http://conceptnet.io.
The included data was created by contributors to Commonsense Computing projects, contributors to Wikimedia projects, DBPedia, OpenCyc, Games with a Purpose, Princeton University's WordNet, Francis Bond's Open Multilingual WordNet, and Jim Breen's JMDict.
For a full list of licenses and attributions for included resources such as WordNet, Open Multilingual WordNet, and Wikimedia projects, please see the original dataset card.
## Citation Information
If you use this data in your work, please cite the original ConceptNet 5.5 paper:
```bibtex
@inproceedings{speer2017conceptnet,
author = {Robyn Speer and Joshua Chin and Catherine Havasi},
title = {ConceptNet 5.5: An Open Multilingual Graph of General Knowledge},
booktitle = {Proceedings of the AAAI Conference on Artificial Intelligence},
year = {2017},
pages = {4444--4451},
url = {http://aaai.org/ocs/index.php/AAAI/AAAI17/paper/view/14972}
}
```