Datasets:
ArXiv:
License:
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,28 +1,130 @@
|
|
| 1 |
-
|
| 2 |
---
|
| 3 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
-
# Normalized ConceptNet Database (Multi-Language)
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
-
- `node_pk` (INTEGER PRIMARY KEY): New integer ID for the node.
|
| 17 |
-
- `node_url` (TEXT UNIQUE): Original ConceptNet URL (e.g., `http://conceptnet.io/c/en/dog`).
|
| 18 |
|
| 19 |
-
|
| 20 |
-
- `rel_pk` (INTEGER PRIMARY KEY): New integer ID for the relation.
|
| 21 |
-
- `rel_url` (TEXT UNIQUE): Original relation URL (e.g., `http://conceptnet.io/r/IsA`).
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
pretty_name: ConceptNet 5 (Normalized SQLite, Filtered)
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- fr
|
| 7 |
+
- it
|
| 8 |
+
- de
|
| 9 |
+
- es
|
| 10 |
+
- ar
|
| 11 |
+
- fa
|
| 12 |
+
- grc
|
| 13 |
+
- he
|
| 14 |
+
- la
|
| 15 |
+
- hbo
|
| 16 |
+
multilinguality: multilingual
|
| 17 |
+
tags:
|
| 18 |
+
- conceptnet
|
| 19 |
+
- knowledge-graph
|
| 20 |
+
- sqlite
|
| 21 |
+
- normalized
|
| 22 |
---
|
|
|
|
| 23 |
|
| 24 |
+
# Normalized ConceptNet 5 (SQLite, Filtered)
|
| 25 |
+
|
| 26 |
+
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.
|
| 27 |
+
|
| 28 |
+
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.
|
| 29 |
+
|
| 30 |
+
This version has been processed to be significantly smaller, faster, and data-correct.
|
| 31 |
+
|
| 32 |
+
## Key Features
|
| 33 |
+
|
| 34 |
+
- **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%.
|
| 35 |
+
|
| 36 |
+
- **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`.
|
| 37 |
+
|
| 38 |
+
- **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`).
|
| 39 |
+
|
| 40 |
+
- **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.
|
| 41 |
+
|
| 42 |
+
## Database Schema
|
| 43 |
+
|
| 44 |
+
This SQLite file (`conceptnet_normalized.db`) contains three tables:
|
| 45 |
+
|
| 46 |
+
### node_norm
|
| 47 |
+
|
| 48 |
+
- `node_pk` (INTEGER PRIMARY KEY): The new, unique integer ID for the node.
|
| 49 |
+
- `node_url` (TEXT UNIQUE NOT NULL): The original ConceptNet URL (e.g., `http://conceptnet.io/c/en/dog`).
|
| 50 |
+
- `language` (TEXT NOT NULL): The language code for the node (e.g., `en`, `de`), extracted from the source DB.
|
| 51 |
+
|
| 52 |
+
### rel_norm
|
| 53 |
+
|
| 54 |
+
- `rel_pk` (INTEGER PRIMARY KEY): The new, unique integer ID for the relation.
|
| 55 |
+
- `rel_url` (TEXT UNIQUE NOT NULL): The original relation URL (e.g., `http://conceptnet.io/r/IsA`).
|
| 56 |
+
|
| 57 |
+
### edge_norm
|
| 58 |
+
|
| 59 |
+
- `start_fk` (INTEGER NOT NULL): Foreign key to `node_norm.node_pk`.
|
| 60 |
+
- `end_fk` (INTEGER NOT NULL): Foreign key to `node_norm.node_pk`.
|
| 61 |
+
- `rel_fk` (INTEGER NOT NULL): Foreign key to `rel_norm.rel_pk`.
|
| 62 |
+
- `weight` (REAL NOT NULL): The edge weight.
|
| 63 |
+
|
| 64 |
+
## How to Use
|
| 65 |
+
|
| 66 |
+
You can query this database using any standard SQLite library.
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
import sqlite3
|
| 70 |
+
import pandas as pd
|
| 71 |
+
|
| 72 |
+
DB_PATH = "conceptnet_normalized.db" # Or path from hf_hub_download
|
| 73 |
+
conn = sqlite3.connect(f"file:{DB_PATH}?mode=ro", uri=True)
|
| 74 |
+
|
| 75 |
+
# Example: Get the top 5 'IsA' relationships for 'dog'
|
| 76 |
+
query = """
|
| 77 |
+
SELECT
|
| 78 |
+
n_start.node_url AS start_node,
|
| 79 |
+
r.rel_url AS relation,
|
| 80 |
+
n_end.node_url AS end_node,
|
| 81 |
+
e.weight
|
| 82 |
+
FROM edge_norm e
|
| 83 |
+
JOIN node_norm n_start ON e.start_fk = n_start.node_pk
|
| 84 |
+
JOIN node_norm n_end ON e.end_fk = n_end.node_pk
|
| 85 |
+
JOIN rel_norm r ON e.rel_fk = r.rel_pk
|
| 86 |
+
WHERE
|
| 87 |
+
n_start.node_url = 'http://conceptnet.io/c/en/dog'
|
| 88 |
+
AND r.rel_url = 'http://conceptnet.io/r/IsA'
|
| 89 |
+
ORDER BY e.weight DESC
|
| 90 |
+
LIMIT 5;
|
| 91 |
+
"""
|
| 92 |
+
|
| 93 |
+
df = pd.read_sql_query(query, conn)
|
| 94 |
+
print(df)
|
| 95 |
+
|
| 96 |
+
conn.close()
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
## Original Dataset Description
|
| 100 |
+
|
| 101 |
+
- **Homepage**: https://github.com/commonsense/conceptnet5/wiki
|
| 102 |
+
- **Repository**: https://github.com/commonsense/conceptnet5/wiki
|
| 103 |
+
- **Paper**: https://arxiv.org/abs/1612.03975
|
| 104 |
+
|
| 105 |
+
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).
|
| 106 |
+
|
| 107 |
+
This dataset is derived from the `conceptnet5` dataset (also on the Hub) and the `cstr/conceptnet-de-indexed` repository.
|
| 108 |
+
|
| 109 |
+
## Licensing Information
|
| 110 |
+
|
| 111 |
+
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.
|
| 112 |
|
| 113 |
+
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.
|
| 114 |
|
| 115 |
+
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.
|
| 116 |
|
| 117 |
+
## Citation Information
|
|
|
|
|
|
|
| 118 |
|
| 119 |
+
If you use this data in your work, please cite the original ConceptNet 5.5 paper:
|
|
|
|
|
|
|
| 120 |
|
| 121 |
+
```bibtex
|
| 122 |
+
@inproceedings{speer2017conceptnet,
|
| 123 |
+
author = {Robyn Speer and Joshua Chin and Catherine Havasi},
|
| 124 |
+
title = {ConceptNet 5.5: An Open Multilingual Graph of General Knowledge},
|
| 125 |
+
booktitle = {Proceedings of the AAAI Conference on Artificial Intelligence},
|
| 126 |
+
year = {2017},
|
| 127 |
+
pages = {4444--4451},
|
| 128 |
+
url = {http://aaai.org/ocs/index.php/AAAI/AAAI17/paper/view/14972}
|
| 129 |
+
}
|
| 130 |
+
```
|