Get synsets (word meanings) for a Danish word, returning a sorted list of lexical concepts.
DanNet follows the OntoLex-Lemon model where:
- Words (ontolex:LexicalEntry) evoke concepts through senses
- Synsets (ontolex:LexicalConcept) represent units of meaning
- Multiple words can share the same synset (synonyms)
- One word can have multiple synsets (polysemy)
This function returns all synsets associated with a word, effectively giving you
all the different meanings/senses that word can have. Each synset represents
a distinct semantic concept with its own definition and semantic relationships.
Common patterns in Danish:
- Nouns often have multiple senses (e.g., "kage" = cake/lump)
- Verbs distinguish motion vs. state (e.g., "løbe" = run/flow)
- Check synset's dns:ontologicalType for semantic classification
DDO CONNECTION AND SYNSET LABELS:
Synset labels are compositions of DDO-derived sense labels, showing all words that
express the same meaning. For example:
- "{hund_1§1; køter_§1; vovhund_§1; vovse_§1}" = all words meaning "domestic dog"
- "{forlygte_§2; babs_§1; bryst_§2; patte_1§1a}" = all words meaning "female breast"
Each individual sense label follows DDO structure:
- "hund_1§1" = word "hund", entry 1, definition 1 in DDO (ordnet.dk)
- "patte_1§1a" = word "patte", entry 1, definition 1, subdefinition a
- The § notation connects directly to DDO's definition numbering system
This composition reveals the semantic relationships between Danish words and their
shared meanings, all traceable back to authoritative DDO lexicographic data.
RETURN BEHAVIOR:
This function has two possible return modes depending on search results:
1. MULTIPLE RESULTS: Returns List[SearchResult] with basic information for each synset
2. SINGLE RESULT (redirect): Returns full synset data Dict when DanNet automatically
redirects to a single synset. This provides immediate access to all semantic
relationships, ontological types, sentiment data, and other rich information
without requiring a separate get_synset_info() call.
The single-result case is equivalent to calling get_synset_info() on the synset,
providing the same comprehensive RDF data structure with all semantic relations.
Args:
query: The Danish word or phrase to search for
language: Language for labels and definitions in results (default: "da" for Danish, "en" for English when available)
Note: Only Danish words can be searched regardless of this parameter
Returns:
MULTIPLE RESULTS: List of SearchResult objects with:
- word: The lexical form
- synset_id: Unique synset identifier (format: synset-NNNNN)
- label: Human-readable synset label (e.g., "{kage_1§1}")
- definition: Brief semantic definition (may be truncated with "...")
SINGLE RESULT: Dict with complete synset data including:
- All RDF properties with namespace prefixes (e.g., wn:hypernym)
- dns:ontologicalType → semantic types with @set array
- dns:sentiment → parsed sentiment (if present)
- synset_id → clean identifier for convenience
- All semantic relationships and linguistic properties
Examples:
# Multiple results case
results = get_word_synsets("hund")
# Returns list of search result dictionaries for all meanings of "hund"
# => [{"word": "hund", "synset_id": "synset-3047", ...}, ...]
# Single result case (redirect)
result = get_word_synsets("svinkeærinde")
# Returns complete synset data for unique word
# => {'wn:hypernym': 'dn:synset-11677', 'dns:sentiment': {...}, ...}