Mova0.6 pre-release

mova-articles

The definite articles in place names, for the languages of the 79 editions (76 base codes: es-ES and es-419, pt-PT and pt-BR, zh-CN and zh-TW share theirs). A site that writes «the weather in …» in many languages uses it to join a preposition to a place name as each language writes it, and to capitalize a name at the start of a title. No dependencies; deterministic; every rule cites its source (an academy, a style guide or a grammar) in Lang::source.

Languages

kindwhat it meanslanguages
InNamethe article belongs to the name and is written in iten, fr, ca, it, es, gl, nl, ar, ga, cy, mt
Contextualthe sentence adds the article; the cited name has nonept, de, el, hu, af, lb
Suffixedthe article is a suffix; the name is cited without itro, sq, sv, da, nb, is, bg, mk, eu, hy, am
Unsplitan article exists but cannot be told from the spellinghe
Noneno definite article in place namestl, ha, yo and 44 more (LANGS; Dryer 2013, WALS chapter 37)

API

Rules worth knowing

Examples

use mova_articles::{contract, sentence_initial, split};

assert_eq!(contract("ca", "a", "el Caire").as_deref(), Some("al Caire"));
assert_eq!(contract("fr", "à", "Le Caire").as_deref(), Some("au Caire"));
assert_eq!(contract("fr", "à", "La Haye").as_deref(), Some("à La Haye"));
assert_eq!(contract("it", "di", "L'Aia").as_deref(), Some("dell'Aia"));
assert_eq!(contract("es-ES", "de", "El Cairo").as_deref(), Some("de El Cairo"));
assert_eq!(contract("ar", "ب", "القاهرة").as_deref(), Some("بالقاهرة"));
assert_eq!(sentence_initial("ca", "el Caire"), "El Caire");
assert_eq!(split("ca", "l'Havana"), ("l'".to_string(), "Havana".to_string()));

Limits

Gender is not known, so Italian il/lo/la and Catalan el/la are not chosen, only their elision is checked; an aspirated h (fr «Le Havre», «La Haye») allows both forms; Catalan «la» before an unstressed i/u is not checked; Irish contractions are not modeled; Greek σε + article and German im/zum need the case and the gender a cited name does not carry; Wikipedia titles start with a capital by software, so casing is checked against the convention, never against a title.

Run

cargo test --release --offline -p mova-articles

Code: the Elamur Cosmic License (Elamur Cosmic License at the repo root).

This page in Markdown https://md.mova.elamur.ai/free/en/docs/tools/articles/