WALS Generic Datapoint #
Shared infrastructure for all 192 WALS feature files. Each feature file
defines its own inductive type for feature values and a List (Datapoint V)
of observations. The generic lookup functions and datapoint structure
live here.
See Data/WALS/Features/ for the per-feature data files, auto-generated
by python3 scripts/gen_wals.py.
A single WALS datapoint, parameterized by the feature value type V.
The human-readable language name is intentionally absent from this struct —
each entry already references a walsCode, and Data.WALS.Languages.findLanguage
is the canonical lookup for human names. Storing the name in every per-feature
entry duplicates ~2660 strings across 192 feature files for no consumer benefit
and inflates Lean elaboration time.
- walsCode : String
- iso : String
- value : V
Instances For
Equations
- Data.WALS.instReprDatapoint = { reprPrec := Data.WALS.instReprDatapoint.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Look up a language by WALS code.
Equations
- Data.WALS.Datapoint.lookup data code = List.find? (fun (x : Data.WALS.Datapoint V) => x.walsCode == code) data
Instances For
Look up a language by ISO 639-3 code.
Returns none for empty queries: WALS marks a handful of languages with an
empty iso field (e.g. WALS code tbu, aze), and a naive find? on ""
would return one of those entries arbitrarily.
Equations
- Data.WALS.Datapoint.lookupISO data iso = if iso.isEmpty = true then none else List.find? (fun (x : Data.WALS.Datapoint V) => x.iso == iso) data