Commit cad78a44 authored by Siltaar's avatar Siltaar
Browse files

support real Greek month names ; fix 3 other langs

parent ea3cb81c
......@@ -4,7 +4,7 @@
:toc-title: Index
`month_nb.js` is a small utility which knows the corresponding number of a month
name, in 69 https://en.wiktionary.org/wiki/Appendix:Months_of_the_year[languages].
name, in 71 https://en.wiktionary.org/wiki/Appendix:Months_of_the_year[languages].
== Usage
......@@ -60,20 +60,20 @@ This clear separation between code and data is wanted to ease the re-use of
`month_nb.json` data structure with other languages, to reimplement a
`month_nb` feature.
An experimental *Python implementation* is provided with currently 49
An experimental *Python implementation* is provided with currently 53
working languages (only).
== Supported languages
`month_nb.js` works for 69 languages (including most living written languages),
`month_nb.js` works for 71 languages (including most living written languages),
but there two ambiguities :
- Croatian : _listopad_ fails to return 10 as it is 11 in Czech and Polish
- Slovenian : _prosinec_ fails to return 1, as it is 12 in Croatian and Czech
Support for those languages has been postponed : Chechen, Cherokee, Hawaiian, Lezgi,
Navajo, Ojibwe, Old English, Old High German, Old Norse.
Support for those languages has been postponed : Cherokee, Hawaiian, Lezgi,
Navajo, Ojibwe, Old English, Old High German, Old Norse, Sinhalese.
== Character encoding considerations
......@@ -111,12 +111,11 @@ file).
To test `month_nb.js` against the language definition file, run :
```sh
$ node --experimental-modules test_month_nb.mjs
$ node test_month_nb.js
```
The `node` v10.15.2 command comes from the `nodejs` package on Debian-based
distributions. The `node-fetch` and `node-requirejs` packages are also
required.
The `node` v15.8.0 command comes from the `nodejs` package on Arch-based
distributions such as Artix Linux.
It will display various informations about the working and broken languages.
......@@ -133,7 +132,7 @@ It will display various informations about the working and broken languages.
The Wiktionary snapshot page of
https://en.wiktionary.org/wiki/Appendix:Months_of_the_year[Appendix:Months_of_the_year]
used is from 2019-09-18. 14 languages were added since the 2013 version of the
initial release of `month_nb`, they are not supported yet.
initial release of `month_nb`, they are not all supported yet.
=== Node packaging
......
......@@ -31,17 +31,19 @@
"Galician":["xaneiro","febreiro","marzo","abril","maio","xuño","xullo","agosto","setembro","outubro","novembro","decembro"],
"Georgian":["იანვარი (ianvari)","თებერვალი (tebervali)","მარტი (marṭi)","აპრილი (aṗrili)","მაისი (maisi)","ივნისი (ivnisi)","ივლისი (ivlisi)","აგვისტო (agvisṭo)","სექტემბერი (sekṭemberi)","ოქტომბერი (okṭomberi)","ნოემბერი (noemberi)","დეკემბერი (deḳemberi)"],
"German":["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],
"Greek":["Ιανουάριος (Ianouários)","Φεβρουάριος (Fevrouários)","Μάρτιος (Mártios)","Απρίλιος (Aprílios)","Μάιος (Máios)","Ιούνιος (Ioúnios)","Ιούλιος (Ioúlios)","Αύγουστος (Ávgoustos)","Σεπτέμβριος (Septémvrios)","Οκτώβριος (Októvrios)","Νοέμβριος (Noémvrios)","Δεκέμβριος (Dekémvrios)"],
"Greek":["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"],
"Greek latin":["Ianouários","Fevrouários","Mártios","Aprílios","Máios","Ioúnios","Ioúlios","Ávgoustos","Septémvrios","Októvrios","Noémvrios","Dekémvrios"],
"Greek demosphere":["Ιανουαρίου", "Φεβρουαρίου", "Μαρτίου", "Απριλίου", "Μαίου", "Ιουνίου", "Ιουλίου", "Αυγούστου", "Σεπτεμβρίου", "Οκτωβρίου", "Νοέμβριος", "Δεκεμβρίου"],
"Haitian Creole":["janvye","fevriye","mas","avril","me","jen","jiyè","out","septanm","oktòb","novanm","desanm"],
"Hawaiian":["Ianuali","Pepeluali","Malaki","ʻApelila","Mei","Iune","Iulai","ʻAukake","Kepakemapa","ʻOkakopa","Nowemapa","Kēkēmapa"],
"Hebrew":["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],
"Hindi":["जनवरी (janvarī)","फ़रवरी (farvarī)","मार्च (mārc)","अप्रैल (aprail)","मई (maī)","जून (jūn)","जुलाई (julāī)","अगस्त (agast)","सितंबर (sitambar)","अक्टूबर (akṭūbar)","नवंबर (navambar)","दिसंबर (disambar)"],
"Hungarian":["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],
"Icelandic":["janúar,janúarmánuður(confer þorri)","febrúar,febrúarmánuður(confer góa)","mars,marsmánuður(confer einmánuður)","apríl,aprílmánuður(confer harpa)","maí,maímánuður(confer skerpla)","júní,júnímánuður(confer sólmánuður)","júlí,júlímánuður(confer heyannir)","ágúst,ágústmánuður(confer tvímánuður)","september,septembermánuður(confer haustmánuður)","október,októbermánuður(confer gormánuður)","nóvember,nóvembermánuður(confer ýlir)","desember,desembermánuður(confer mörsugur)"],
"Indonesian":["Januari","Februari","Maret","April","Mei","Template:Juni","Juli","Agustus","September","Oktober","November","Desember"],
"Indonesian":["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],
"Irish":["Eanáir","Feabhra","Márta","Aibreán","Bealtaine","Meitheamh","Iúil","Lúnasa","Meán Fómhair","Deireadh Fómhair","Samhain","Mí na Nollag"],
"Italian":["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],
"Japanese":["一 (いち)月 (がつ) (ichigatsu)","二 (に)月 (がつ) (nigatsu)","三 (さん)月 (がつ) (sangatsu)","四 (し)月 (がつ) (shigatsu)","五 (ご)月 (がつ) (gogatsu)","六 (ろく)月 (がつ) (rokugatsu)","七 (しち)月 (がつ) (shichigatsu)","八 (はち)月 (がつ) (hachigatsu)","九 (く)月 (がつ) (kugatsu)","十 (し)月 (がつ) (shigatsu)","十 (じゅう)一 (いち)月 (がつ) (jūichigatsu)","十 (じゅう)二 (に)月 (がつ) (jūnigatsu)"],
"Japanese":["一 (いち)月 (がつ) (ichigatsu)","二 (に)月 (がつ) (nigatsu)","三 (さん)月 (がつ) (sangatsu)","四 (し)月 (がつ) (shigatsu)","五 (ご)月 (がつ) (gogatsu)","六 (ろく)月 (がつ) (rokugatsu)","七 (しち)月 (がつ) (shichigatsu)","八 (はち)月 (がつ) (hachigatsu)","九 (く)月 (がつ) (kugatsu)","十 (し)月 (がつ) (shigatsu)","十一 (いち)月 (がつ) (jūichigatsu)","十二 (に)月 (がつ) (jūnigatsu)"],
"Kalmyk":["туула сар (tuula sar)","лу сар (lu sar)","моһа сар (moha sar)","мөрн сар (mörn sar)","хөн сар (xön sar)","мөчн сар (möçn sar)","така сар (taka sar)","ноха сар (noxa sar)","һаха сар (haxa sar)","хулһн сар (xulhn sar)","үкр сар (ükr sar)","бар сар (bar sar)"],
"Kazakh":["қантар (qantar)","ақпан (aqpan)","наурыз (nawrız)","сәуір (säwir)","мамыр (mamır)","маусым (mawsım)","шілде (şilde)","тамыз (tamız)","қыркүйек (qırküyek)","қазан (qazan)","қараша (qaraşa)","желтоқсан (jeltoqsan)"],
"Khmer":["មករា (mĕəʾkaʾraa)","កុម្ភៈ (komphĕəʾ)","មីនា (miinaa)","មេសា (meisaa)","ឧសភា (ʾosaʾphiə)","មិថុនា (mithonaa)","កក្កដា (kɑkkaʾdaa)","សីហា (səyhaa)","កញ្ញា (kaññaa)","តុលា (tolaa)","វិច្ឆិកា (vɨcchekaa)","ធ្នូ (thnuu)"],
......
......@@ -32,23 +32,23 @@
"^([\\u0000-\\u024F]|[\\u0370-\\u03FF]|[\\u0530-\\u058F]|[\\u0D80-\\u0DFF]|[\\u10A0-\\u10FF])": {
"comment": "latin, greek, armenian, sinhala, georgian",
"^([ijΙygelhxğජი]|d[ij][ua]|հու)": {
"^.?[ijyouο]?[uúüūύeiոජූვ][igւ]?[nñνնනිნ$]([^aäվnweවාg]|e?$)": 6,
"^(.[aαāniíjոනა]|[ig]e)ւ?([aneνවාნ]|նվ)": 1,
"^.?[iyjouο]?[uúüūύiոජූვ][iygւ]?[lèλլලිლ$]([^u]|$)": 7
"^.?[ijyouο]?[uúüūυύνeiոජූვ]+[iίgւ]?[nñνնනිნ$]([^aäվnweවාg]|e?$)": 6,
"^(.[aαāniíjոනა]|[ig]e)ւ?([aneνნ]|\u0576)[^p]" : 1,
"^.?[ijyouο]?[uúüūυύνiոජූვ]+[iίygւ]?[lèλլලිლ$]([^u]|$)": 7
},
"^[mΜմමმ]": {
"^(..[ae]?[rsctρրრ]([^r](([^e]|ec)|$)|$)|මා)": 3,
"^(.[aāáάաeა]([ijīíygaeιյი]|$)([^l]|$)|මැ)": 5
"^(.[aāáαάաeა]([ijīíίygaeιյი]|$)([^lt]|$)|මැ)": 5
},
"^([aäΑáաօඅა]|o[igu][^b]*$)": {
"^.(.[rρր]|[පპ])": 4,
"^.([ගგ]|[ouŭgύivwգ]([uûúgtoγո]|$)[^b]*$)": 8
"^.(..?[rρրи][^a]|[පპ])": 4,
"^.([ගგ]|[ouŭgυύivwգ]([uûúgtoγո]|$)[^b]*$)": 8
},
"^([fvΦփපთ][^ia][^l]|p[he])": 2,
"^[sΣսසැს]z?[eεեප්තැე]": 9,
"^[oöuΟհඔო][^nžrijīíygΙ][^a]": 10,
"^[nΝնනნ][^ijīíygΙ][^l]": 11,
"^[dΔդදდ][^u]": 12,
"^[dΔդදდ][^u][^i]": 12,
"^th": {
" m": {
"mư.*ha[ijīíygјΙ]": 12,
......@@ -69,18 +69,18 @@
" n": 5,
" h": 2
},
"^(pro|gru|jo|ar|rh|ui)": 12,
"^(lis|stu|m[aä]r|ka[^un]|tac|ca)": 11,
"^(říj|pa|lo|^vi|ek|hy|re|nu)": 10,
"^([zw]|sy|ru|ki|ey|med|sü|am.*aq$)": 9,
"^(srpe|sie|ko|el|v.* s|ağ|aw|põ|am.*un$)": 8,
"^(č.*c|srp|lipi|hei|m.* s|te[^n]|go|hai|ing)": 7,
"^(č|c[^ha]|k(e[^p]|au)|lipa|ro|ha[^i]|meh|pi)": 6,
"^([ks]v[^e]|to|v.* t|leh|qu)": 5,
"^(du|tr|kw|hu|m.* t|ni|eb|mah|Tengmiirvik)": 4,
"^(ož|bř|maa|su|maw|urb|Tengmiirvig)": 3,
"^(ú|lu|[hv]el|sv|şu|ch|ra|kep)": 2,
"^(s[it]|le[^h]|ta[^c]|oc|io|vah|kan)": 1
"^(pro|gru|jo|ar|rh|ui|Mí)": 12,
"^(lis|stu|m[aä]r|ka[^un]|tac|ca|Sam|lap)": 11,
"^(říj|pa|lo|^vi|ek|hy|re|nu|Deir|spa)": 10,
"^([zw]|sy|ru([^g]|(g[^p]))|ki|ey|med|sü|am.*aq$|Meá)": 9,
"^(srpe|sie|ko[^v]|el|v.* s|ağ|aw|põ|am.*un$|Lún|rug|Amir)": 8,
"^(č.*c|srp|lipi|hei|m.* s|te[^n]|go|hai|ing|liep)": 7,
"^(č|c[^ha]|k(e[^p]|au)|lipa|ro|ha[^i]|meh|pi|meit|bir)": 6,
"^([ks]v[^e]|to|v.* t|leh|qu|bea|geg)": 5,
"^(du|tr|kw|hu|m.* t|ni|eb|mah|bal|Tengmiirvik)": 4,
"^(ož|bř|maa|su|maw|urb|kov|Tengmiirvig)": 3,
"^(ú|lu|[hv]el|sv|şu|ch|[rv]a[^h]|kep)": 2,
"^(s[ita]|le[^h]|ta[^c]|oc|io|vah|kan)": 1
},
"^([\u0590-\u05FF]|[\u0600-\u06FF]|[\u0900-\u097F])": {
"comment": "hebrew, arabic, hindi devanagari",
......@@ -123,7 +123,7 @@
},
"^([\u3000-\u9FFF]|[\uAC00-\uD7AF])": {"comment": "hiragana katagana chinese, korean hangul",
"^[十\u3229시십]": {
"^.[月\u322A월]": 10,
"^.([ 月\u322A월]|$)": 10,
"^.[一\u3220일]": 11,
"^.[二\u3221이]": 12
},
......@@ -138,44 +138,52 @@
"^[九구]": 9
},
"^([\u0400-\u052F])": {"comment": "cyrillic slavic",
"^[яиюј]": {
"^[^ю]?[юу]н": 6,
"^([^ю][најы]|[ј])[увн][^л]": 1,
"^[^ю]?[ο]?[ј]?[јюу][ј]?л": 7
"^[яиюјқш]": {
"^[^ю]?(июн|ю́н|ун|у́н)": 6,
"^[^ю]?[ο]?[ј]?([јі][ј]?л|ю́л|у́л|ул)": 7,
"^([^ю][најы]|ј)[увн]": 1
},
"^м": {
"^(..[а]?[р])": 3,
"^.[а](ј|й|$)": 5
"^(..а?р)[^с]": 3,
"^.а(ј|й|м|$)": 5,
"^.ау": 6
},
"^а": {
"^.(.[р])": 4,
"^.([јв]([јг]|$))": 8
"^...?[р]": 4,
"^(.ј(ј|$)|а́вг|авг)": 8,
".қ": 2
},
"^[сгб]..[^п]": {
"^[сгбн]..[^п]": {
"comment": "other",
"^.[нр]": 12,
"^.[ае][^пн]": 3,
"^.[ті]": 1
"^.[аеу][^пнзй][^п][^п]": 3,
"^.[тіэ][^и]": 1
},
"^л": {
"^.[iи]": {
"^.[iиі́]": {
"^..с": 11,
"^..п": 7
"^.і́п": 7
},
"^.ю": 2
},
"^[кж][^н]": {
"^.[ао]": 10,
"^.[рв]": 4
"^[кқжс][^н]": {
"^.[ао][^р]": 10,
"^.[рвә]": 4,
"^.ыр": 9,
"^.ар": 11
},
"^ф[^јΙа]": 2,
"^(се[^р]|в)": 9,
"^[о][^ј]": 10,
"^[Νн]": 11,
"^д": 12,
"^[жс]": 8,
"^ч": 6,
"^т": 5
"^(де[ркц][^ө]|жел|Гӏу|арванх)": 12,
"^([Νн][^а]|Лах|арванн)": 11,
"^(о[^јх]|Гӏа|ара)": 10,
"^(се[^р][^п][^п]|в|Гез|есд)": 9,
"^([жс][^т]|там|Мар|най|се́р)": 8,
"^(Тов|дол|июл|ли́п)": 7,
"^(ч[^и]|Ман|зур)": 6,
"^(т[^о]|Сти)": 5,
"^(дөр|Оха)": 4,
"^Заз": 3,
"^(ф[^јΙа])|хоё|Чил": 2,
"^(Деч|гый)": 1
},
"^([\u1200-\u137F])": {"comment": "amharic",
"^ጁ": {
......
......@@ -37,7 +37,7 @@ for lang, month_names in month_definitions.items():
else:
print('')
working_lang_nb += 1
print('Total :', len(broken_lang) + working_lang_nb, 'over 96')
print('Total :', len(broken_lang) + working_lang_nb, 'over 98')
print('Working lang. :', working_lang_nb)
print('Broken lang. :', len(broken_lang))
print(', '.join(broken_lang))
/* globals process */
import * as month_nb from "./month_nb_node-10.x.js"
import * as month_nb_json_default from "./month_nb.json"
import * as month_definitions from "./month_definitions/2019_definitions.json"
/* globals process require */
// import * as month_nb from "./month_nb_node-10.x.js"
// import * as month_nb_json_default from "./month_nb.json"
// import * as month_definitions from "./month_definitions/2019_definitions.json"
const month_nb_json = month_nb_json_default.default
var langs = Object.keys(month_definitions.default)
var month_nb = require('./month_nb_node-10.x.js')
var month_nb_json_default = require('./month_nb.json')
var month_definitions = require('./month_definitions/2019_definitions.json')
const month_nb_json = month_nb_json_default
var langs = Object.keys(month_definitions)
var month_names = []
var broken_lang = ['Abkhaz', 'Bashkir', 'Buryat', 'Cherokee', 'Chuvash', 'Erzya', 'Hawaiian',
'Kalmyk', 'Lezgi', 'Moksha', 'Navajo', 'Ojibwe', 'Old English', 'Old High German',
'Old Norse', 'Tibetan', 'Udmurt', 'Uyghur', 'Veps', 'Vietnamese', 'Welsh', 'Yakut',
'Yiddish', 'Zazaki']
'Old Norse', 'Tibetan', 'Udmurt', 'Uyghur', 'Veps', 'Welsh', 'Yakut',
'Yiddish', 'Zazaki', 'Sinhalese']
var working_lang_nb = 0
for (let lang of langs) {
if (broken_lang.indexOf(lang) > -1)
continue
month_names = month_definitions.default[lang]
month_names = month_definitions[lang]
let short_month_names = []
for (let a of month_names)
short_month_names.push(a.slice(0,3))
......@@ -28,7 +32,7 @@ for (let lang of langs) {
while(month_index < 12) {
month_name = month_names[month_index]
month_value = month_index + 1
month_nb_res = month_nb.default.month_nb(month_name, month_nb_json)
month_nb_res = month_nb.month_nb(month_name, month_nb_json)
if (!(month_nb_res == month_value)) {
console.log(`${month_name} gave ${month_nb_res} instead of ${month_value}`)
broken_lang.push(lang)
......@@ -42,7 +46,7 @@ for (let lang of langs) {
}
}
}
console.log(`Total : ${working_lang_nb + broken_lang.length} over 96`)
console.log(`Total : ${working_lang_nb + broken_lang.length} over 98`)
console.log(`Working lang. : ${working_lang_nb}`)
console.log(`broken lang. : ${broken_lang.length}`)
console.log(broken_lang.join(', '))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment