User:Tynnoel/Ordbøkene interfacing

The new front end for the Nynorsk Dictionary and the Bokmål Dictionary – ordbokene.no – was released as a beta version in late 2021 to replace ordbok.uib.no. From January 26th 2022 it is the default version. The old one is still avaiable for some time, but we should already now migrate to the new one, as it is the one recommended for use by the publishers, and also the one where content will be updated in the future.

Module:R:The_Bokmål_and_Nynorsk_dictionaries will need to be rewritten, and I use this page to document how the interface is set up.

URL syntax
The URL is formed like this:

https://ordbokene.no/{lang}/search?q={search term}&pos={part of speech}&scope={scope}&perPage={perPage}

lang
{lang} is one of
 * nn – only Nynorsk
 * bm – only Bokmål
 * bm,nn – both

search term
{search term} is whatever string is searched for. Strings may include the wildcards
 * _ denoting *one* arbitrary character
 * % (written as %25 in the url) or * denoting a variable number of arbitrary characters – zero or more

pos
Restricts the search to one part of speech. Possible values: To search in all parts of speech, omit the pos argument.
 * verb – Verbs
 * noun – Nouns
 * adj – Adjectives
 * pron – Pronouns
 * det – Determiners
 * adv – Adverbs
 * cconj – Conjunctions
 * sconj – Subjunctions
 * intj – Interjections

scope
Defines where the search is conducted, using one or more of the following The order of e, i and f does not seem to matter, but they are put in that order – eif – by the interface. If no scope is given, it works as if the scope was "ei".
 * e – Lemmas/entries
 * i – Inflected forms
 * f – Free text, i.e. the entire dictionary article

perPage
Defines how many results are shown per page.

Examples
Search for "nav" in both dictionaries, all parts of speech, both as entry and in inflected forms:

https://ordbokene.no/bm,nn/search?q=nav&scope=ei

Search for "nav" in The Nynorsk Dictionary, as a noun, as entry, inflected form or anywhere else in the article:

https://ordbokene.no/nn/search?q=nav&pos=noun&scope=eif

Search for "for" in The Bokmål Dictionary, all parts of speech, as entry, inflected form or anywhere else in the article. Limit to 5 results per page:

https://ordbokene.no/bm/search?q=for&scope=efi&perPage=5

Module sandbox
Module:User:Tynnoel/R:The_Bokmål_and_Nynorsk_dictionaries

Result
I have updated the module at 2022–03–06 23:48 UTC after testing in the sandbox. Possible improvements could be allowing other parameters to be specified.