Read-only mirror of https://github.com/metadata-swiss/keyword_generator — Bundesamt für Statistik. Issues & pull requests at the source.
  • Python 53.9%
  • HTML 39.6%
  • CSS 6.3%
  • Shell 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sergiy Goloviatinski 91024344be
Merge pull request #36 from metadata-swiss/dependabot/pip/pip-minor-patch-4b9095002b
Bump the pip-minor-patch group with 2 updates
2026-10-12 16:33:31 +02:00
.github Bump docker/setup-buildx-action in the github-actions-minor-patch group 2026-09-28 21:45:30 +00:00
static Multiple improvements and bug fixes 2026-01-13 17:15:39 +01:00
templates Priorization of keyword sources 2026-01-15 10:55:44 +01:00
.dockerignore Added Dockerfile + workflow to push docker image on azure 2026-06-29 16:43:26 +02:00
.env.example Rewrite of keyword generation algorithm 2026-01-08 15:54:04 +01:00
.gitignore Multiple improvements and bug fixes 2026-01-13 17:15:39 +01:00
.python-version Pin to major Python version 2026-01-08 10:12:07 +01:00
app.py fixed potential vulnerabilities, added quality gates in azure deploy pipeline 2026-08-03 13:59:49 +02:00
deploy.sh Multiple improvements and bug fixes 2026-01-13 17:15:39 +01:00
Dockerfile.azure Bump python from 3.12-slim-bookworm to 3.14-slim-bookworm 2026-08-03 12:01:23 +00:00
README.md Multiple improvements and bug fixes 2026-01-13 17:15:39 +01:00
requirements.txt Bump the pip-minor-patch group with 2 updates 2026-10-05 21:45:10 +00:00

DCAT-AP CH Keyword Generator

A Flask web application that generates DCAT-AP CH compliant keywords by searching through multiple controlled vocabularies following the specified priority cascade.

Features

  • Priority-based keyword search following DCAT-AP CH specifications:

    1. TERMDAT (Swiss federal terminology database)
    2. GEMET (Environmental terminology)
    3. Wikidata (General knowledge base)
    4. Literal keywords (fallback)
  • Modern web interface with responsive design

  • Real-time search with loading indicators

  • Structured results showing source, URI, and descriptions

  • Select and download keywords: Click on generated keyword tiles to select them and download the selected keywords in JSON format or upload them to an entry on I14Y.

Setup

  1. Install Python dependencies:

    pip install -r requirements.txt
    
  2. Run the application:

    python app.py
    
  3. Open your browser and go to http://localhost:5000

Hunspell Dictionaries

Compound keyword splitting relies on Hunspell lexicons. On DigitalOcean App Platform the deploy.sh script automatically installs hunspell plus the hunspell-de-CH, hunspell-fr, hunspell-it, and hunspell-en-gb packages so continuous deployment keeps working. For local development run:

sudo apt-get update && sudo apt-get install hunspell hunspell-de-ch hunspell-fr hunspell-it hunspell-en-gb

You can override the dictionary picked at runtime by setting HUNSPELL_DIC_PATH (absolute path to a .dic file) or HUNSPELL_LOCALE (e.g., de_CH). If no system dictionary is found the app falls back to the bundled vocabulary.

Usage

  1. Enter a search term in the input field.
  2. Click "Generate Keywords" or press Enter.
  3. Review the generated keywords sorted by priority.
  4. Click on keyword tiles to select them.
  5. Use the "Download Selected Keywords" button to download the selected keywords in JSON format.
  6. Use the provided URIs for DCAT-AP CH compliance

Implementation Notes

  • TERMDAT: Currently uses a placeholder implementation as TERMDAT doesn't have a public API. In a production environment, you would need to implement web scraping or use their specific API if available.

  • GEMET: Uses the GEMET API for environmental terminology searches. The current implementation includes a mock response structure that should be adapted based on the actual API response format.

  • Wikidata: Implements the Wikidata API for entity searches, returning proper Wikidata URIs.

  • Literal fallback: When no controlled vocabulary matches are found, the system falls back to literal keywords.

API Endpoints

  • GET / - Main application interface
  • POST /search - Keyword search endpoint
    • Request: {"query": "search term"}
    • Response: {"query": "...", "keywords": [...], "total": n}

Future Enhancements

  • Implement proper TERMDAT API integration
  • Add caching for frequently searched terms (in progress)
  • Include multi-language support
  • Add export functionality for different formats
  • Implement user preference settings for keyword sources
  • Display search history in the web interface