Skip to main content

<Select>

Category: Control tag ยท AfriAnnotate-specific

A searchable single- or multi-select. Instead of hand-listing every language or country as <Choice> elements, point the tag at a built-in dataset and, if you like, narrow it: the languages of two countries, the countries of one region, a whitelist of codes. Annotators type a few letters and pick from suggestions; the result is stored exactly like <Choices>, so review, agreement, filters and every export format already understand it.

<View>
<Audio name="audio" value="$audio" zoom="true" hotkey="space"/>
<TextArea name="transcript" toName="audio" rows="6" required="true"/>

<Header value="Language(s) present"/>
<Select name="languages" toName="audio" dataset="languages" countries="NG"
selected="English" required="true"
requiredMessage="Select every language you hear."/>
</View>

The built-in datasetsโ€‹

All four are complete registries, regenerated from the standards with a script in the repository and loaded on first use (one small download per dataset, cached afterwards).

datasetWhat it holdsSource
languagesEvery ISO 639-3 language: 7,867 entries, of which 7,027 living and 143 sign languages. Each carries its ISO 639-3 code, ISO 639-1 code where one exists, English name, native name and aliases, the countries and regions it is spoken in, language family, type and scope.SIL ISO 639-3 registry (the code list Ethnologue uses); countries, native names and families from Glottolog, CLDR and Wikidata; a curated African language-to-country list on top
countriesEvery ISO 3166-1 territory (254) with UN M49 region and subregion and common aliases (DR Congo, Ivory Coast, Swaziland, ...).CLDR territory containment, ICU names
scriptsThe ISO 15924 writing systems (214), with the African ones annotated: Latin, Arabic and Ajami, Ge'ez, N'Ko, Tifinagh, Vai, Adlam, Bamum, Mende Kikakui, Osmanya, Coptic.ISO 15924 registry, ICU names
currenciesISO 4217 currencies in current use (153) with the countries that use them.CLDR currency data, ICU names

Search matches the name, the code, the ISO 639-1 code, aliases and native names, and country codes, so "ha", "hausa" and "ู‡ูŽูˆู’ุณูŽ" all find Hausa, and "zaire" finds the Democratic Republic of the Congo.

Narrowing the listโ€‹

AttributeApplies toExample
regionallregion="Africa" or region="Africa,Asia" (Africa, Americas, Asia, Europe, Oceania)
subregioncountriessubregion="Western Africa,Eastern Africa"
countrieslanguages, currenciescountries="NG,GH" keeps the languages spoken in Nigeria and Ghana
kindlanguagesspoken (default), sign, or all
typeslanguagesliving (default) or all; or a list such as living,extinct
scopelanguagesindividual, macrolanguage, or all (default)
familylanguagesGlottolog top-level family: family="Atlantic-Congo", family="Afro-Asiatic,Nilotic"
includeallwhitelist of codes or names: include="NG,GH,KE,ZA,ET"
excludealldrop entries: exclude="eng,fra"

Filters combine with AND. include alone is the way to offer exactly the handful you want while keeping the search, codes and hints.

Your own list instead of, or on top of, a datasetโ€‹

AttributeEffect
items="Yoruba,English"Use this list and no dataset. items="yor:Yoruba,eng:English" gives each entry a code.
extra="Naija,Pidgin"Append entries to whatever the dataset and filters produce.
value="$languages"Take the list from task data: an array of strings, or of objects {value, code, alt, hint}.
allowCustom="true"Let the annotator add a value that is not in the list by typing it and choosing Add "โ€ฆ". The added value is stored like any other.

Preselecting and lockingโ€‹

AttributeEffect
selected="English"Preselected, but the annotator can remove it. Codes work too: selected="eng".
fixed="Nigeria"Preselected and locked: it stays in the answer whatever the annotator does.

What is storedโ€‹

By default the entry's name is stored, exactly like a <Choice value>:

{ "from_name": "languages", "to_name": "audio", "type": "choices",
"value": { "choices": ["Hausa", "English"] } }

With codes="true" the code is stored instead (["hau", "eng"], ["NG"], ["Latn"], ["NGN"]), which is what most pipelines want. showCodes="true" shows the code next to the name in the list without changing what is stored.

All attributesโ€‹

AttributeTypeDefaultDescription
namestringrequiredName of the element
toNamestringrequiredName of the element it applies to
datasetlanguages | countries | scripts | currenciesBuilt-in list
itemsstringCustom list, comma-separated, optionally code:name
extrastringEntries appended to the list
valuestringTask data field ($field) holding the list
region, subregion, countries, kind, types, scope, family, include, excludestringFilters, see above
selectedstringPreselected entries
fixedstringPreselected and locked entries
codesbooleanfalseStore codes instead of names
showCodesbooleanfalseShow codes in the list
allowCustombooleanfalseAnnotator can add a value
choicesingle | multiplemultipleOne answer or several
layoutselect | inline | verticalselectSearchable dropdown, or checkboxes for short lists
placeholderstringText in the search box
required, requiredMessageAs for Choices
perRegion, visibleWhen, whenTagName, whenChoiceValueAs for Choices

Recipesโ€‹

Code-mixed speech, languages of one country, ISO codes in the export:

<Select name="languages" toName="audio" dataset="languages" countries="NG" codes="true" required="true"/>

Speaker's country, Africa only, one answer:

<Select name="country" toName="audio" dataset="countries" region="Africa" choice="single" codes="true"/>

Script of a scanned page, including the Ajami case:

<Select name="script" toName="image" dataset="scripts" region="Africa" choice="single"/>

A fixed shortlist plus room for surprises:

<Select name="languages" toName="text" dataset="languages" include="hau,yor,ibo,pcm,eng" allowCustom="true"/>

Short list as checkboxes rather than a dropdown:

<Select name="script" toName="text" dataset="scripts" include="Latn,Arab,Ethi" layout="inline" choice="single"/>

Notesโ€‹

  • The dataset chunk downloads the first time a task using the tag opens and is cached by the browser; the languages list is about 1 MB.
  • On the desktop app the datasets ship inside the app, so the tag works offline.
  • Aliases are for search only; the stored value is always the name (or code). Rename nothing: exports from different projects stay comparable.
  • A value an annotator added with allowCustom is kept: when the task is reopened it is offered and selected again even though it is not in the dataset. The same applies if you narrow the list after answers exist.
  • Loading the list is not an edit: opening a task does not mark the annotation as changed and does not create a draft.
  • To rebuild the datasets from the upstream registries: node libs/editor/scripts/select-datasets/build.mjs --refresh in web/.
  • <Choices> โ€” the tag this one extends; use it for short, fixed lists.
  • <Taxonomy> โ€” hierarchical pick-lists you define yourself.
  • Transcribe audio โ€” the recipe this tag was built for.