Datasets:
Download README.md from AsciiMAster/off-categories-bge-m3: direct link, hf CLI and curl.
- Browser
- Download file 4.17 kB
-
https://huggingface.co/datasets/AsciiMAster/off-categories-bge-m3/resolve/main/README.md
- Command line
-
hf download hf://datasets/AsciiMAster/off-categories-bge-m3/README.md
-
curl -L -o README.md https://huggingface.co/datasets/AsciiMAster/off-categories-bge-m3/resolve/main/README.md
license: odbl
language:
- en
- de
- fr
- pl
pretty_name: Open Food Facts Categories with bge-m3 Embeddings
size_categories:
- 10K<n<100K
task_categories:
- feature-extraction
- sentence-similarity
tags:
- open-food-facts
- food
- taxonomy
- embeddings
- bge-m3
- multilingual
- pgvector
configs:
- config_name: default
data_files: off-categories-bge-m3.parquet
Open Food Facts Categories with bge-m3 Embeddings
A flat, embedded version of the Open Food Facts
category taxonomy. Each row is one OFF category with multilingual display
names, its full ancestor path, and a 1024-dimensional embedding produced by
BAAI/bge-m3.
The intent is to let downstream projects do retrieval over OFF categories
without having to re-fetch categories.json, walk the parent graph, or run
the embedding model.
Source project
Generated by BetterCategories / offcat, a small Go service that does natural-language food category search backed by this exact table.
Schema
| Column | Type | Notes |
|---|---|---|
id |
string | OFF category id, e.g. en:apple-juices. Primary key. |
name_en |
string (nullable) | English display name. |
name_pl |
string (nullable) | Polish display name. |
name_de |
string (nullable) | German display name. |
name_fr |
string (nullable) | French display name. |
parents |
list | Direct parent category ids. |
ancestor_path |
string (nullable) | Pre-computed flattened ancestor chain used as embedding context. |
context_hash |
string (nullable) | SHA-256 of the text fed to the embedding model. Useful for diffs. |
embedding |
list[1024] | bge-m3 embedding of name_en + " > " + ancestor_path (cosine). |
Row count: 14352.
Embedding details
- Model:
BAAI/bge-m3(served via an OpenAI-compatible local API in the upstream project; any deployment of the same model produces compatible vectors). - Dimension: 1024.
- Distance: cosine similarity is the intended metric.
- Input text: the English category name concatenated with
" > "and the flattened ancestor path. Seetaxonomy.goin the source project for the exactembedTextForformatting.
Quick start
import pyarrow.parquet as pq
import numpy as np
table = pq.read_table("off-categories-bge-m3.parquet")
df = table.to_pandas()
mat = np.stack(df["embedding"].to_numpy()) # (14352, 1024)
mat /= np.linalg.norm(mat, axis=1, keepdims=True)
# encode a query with bge-m3, normalise, then:
# scores = mat @ query_vec
For Postgres users, the same data is what BetterCategories writes into a
pgvector vector(1024) column with an HNSW cosine-ops index.
Licence and attribution
This dataset is a derivative database of Open Food Facts and is therefore distributed under the Open Database License (ODbL) v1.0, the same licence as the upstream taxonomy.
- Upstream data: Open Food Facts, https://world.openfoodfacts.org/data, ODbL-1.0.
- Modifications applied: parent graph flattened into an
ancestor_pathstring per category;bge-m3embeddings computed over the concatenation of the English name and that ancestor path; rows with no embedding are excluded.
If you redistribute this dataset or a derivative of it (including dumps, indexes, or further-trained models that incorporate the data), you must:
- Keep the resulting database under ODbL-1.0.
- Credit Open Food Facts contributors.
- Note that the data has been modified.
The Go source code that produced this dataset is licensed under MIT and is not covered by ODbL.