Skip to content

Commit

Permalink
EticaAI/numerordinatio#5: will need some strategy to deal with many s…
Browse files Browse the repository at this point in the history
…yscals
  • Loading branch information
eticaaibot committed Jan 6, 2022
1 parent 4d7e4b0 commit f4e093d
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 229 deletions.
213 changes: 0 additions & 213 deletions 999999/999999/1603.47.15924.tsv
Original file line number Diff line number Diff line change
@@ -1,213 +0,0 @@
15 015 Pcun pcun PCUN
16 016 Pelm pelm PELM
20 020 Xsux xsux XSUX
30 030 Xpeo xpeo XPEO
40 040 Ugar ugar UGAR
50 050 Egyp egyp EGYP
60 060 Egyh egyh EGYH
70 070 Egyd egyd EGYD
80 080 Hluw hluw HLUW
85 085 Nkdb nkdb NKDB
90 090 Maya maya MAYA
95 095 Sgnw sgnw SGNW
100 100 Mero mero MERO
101 101 Merc merc MERC
103 103 Psin psin PSIN
105 105 Sarb sarb SARB
106 106 Narb narb NARB
109 109 Chrs chrs CHRS
115 115 Phnx phnx PHNX
116 116 Lydi lydi LYDI
120 120 Tfng tfng TFNG
123 123 Samr samr SAMR
124 124 Armi armi ARMI
125 125 Hebr hebr HEBR
126 126 Palm palm PALM
127 127 Hatr hatr HATR
128 128 Elym elym ELYM
130 130 Prti prti PRTI
131 131 Phli phli PHLI
132 132 Phlp phlp PHLP
133 133 Phlv phlv PHLV
134 134 Avst avst AVST
135 135 Syrc syrc SYRC
136 136 Syrn syrn SYRN
137 137 Syrj syrj SYRJ
138 138 Syre syre SYRE
139 139 Mani mani MANI
140 140 Mand mand MAND
141 141 Sogd sogd SOGD
142 142 Sogo sogo SOGO
143 143 Ougr ougr OUGR
145 145 Mong mong MONG
159 159 Nbat nbat NBAT
160 160 Arab arab ARAB
161 161 Aran aran ARAN
165 165 Nkoo nkoo NKOO
166 166 Adlm adlm ADLM
167 167 Rohg rohg ROHG
170 170 Thaa thaa THAA
175 175 Orkh orkh ORKH
176 176 Hung hung HUNG
192 192 Yezi yezi YEZI
200 200 Grek grek GREK
201 201 Cari cari CARI
202 202 Lyci lyci LYCI
204 204 Copt copt COPT
206 206 Goth goth GOTH
210 210 Ital ital ITAL
211 211 Runr runr RUNR
212 212 Ogam ogam OGAM
215 215 Latn latn LATN
216 216 Latg latg LATG
217 217 Latf latf LATF
218 218 Moon moon MOON
219 219 Osge osge OSGE
220 220 Cyrl cyrl CYRL
221 221 Cyrs cyrs CYRS
225 225 Glag glag GLAG
226 226 Elba elba ELBA
227 227 Perm perm PERM
228 228 Vith vith VITH
230 230 Armn armn ARMN
239 239 Aghb aghb AGHB
240 240 Geor geor GEOR
241 241 Geok geok GEOK
250 250 Dsrt dsrt DSRT
259 259 Bass bass BASS
260 260 Osma osma OSMA
261 261 Olck olck OLCK
262 262 Wara wara WARA
263 263 Pauc pauc PAUC
264 264 Mroo mroo MROO
265 265 Medf medf MEDF
274 274 Sunu sunu SUNU
275 275 Tnsa tnsa TNSA
280 280 Visp visp VISP
281 281 Shaw shaw SHAW
282 282 Plrd plrd PLRD
283 283 Wcho wcho WCHO
284 284 Jamo jamo JAMO
285 285 Bopo bopo BOPO
286 286 Hang hang HANG
287 287 Kore kore KORE
288 288 Kits kits KITS
290 290 Teng teng TENG
291 291 Cirt cirt CIRT
292 292 Sara sara SARA
293 293 Piqd piqd PIQD
294 294 Toto toto TOTO
295 295 Nagm nagm NAGM
300 300 Brah brah BRAH
302 302 Sidd sidd SIDD
303 303 Ranj ranj RANJ
305 305 Khar khar KHAR
310 310 Guru guru GURU
311 311 Nand nand NAND
312 312 Gong gong GONG
313 313 Gonm gonm GONM
314 314 Mahj mahj MAHJ
315 315 Deva deva DEVA
316 316 Sylo sylo SYLO
317 317 Kthi kthi KTHI
318 318 Sind sind SIND
319 319 Shrd shrd SHRD
320 320 Gujr gujr GUJR
321 321 Takr takr TAKR
322 322 Khoj khoj KHOJ
323 323 Mult mult MULT
324 324 Modi modi MODI
325 325 Beng beng BENG
326 326 Tirh tirh TIRH
327 327 Orya orya ORYA
328 328 Dogr dogr DOGR
329 329 Soyo soyo SOYO
330 330 Tibt tibt TIBT
331 331 Phag phag PHAG
332 332 Marc marc MARC
333 333 Newa newa NEWA
334 334 Bhks bhks BHKS
335 335 Lepc lepc LEPC
336 336 Limb limb LIMB
337 337 Mtei mtei MTEI
338 338 Ahom ahom AHOM
339 339 Zanb zanb ZANB
340 340 Telu telu TELU
342 342 Diak diak DIAK
343 343 Gran gran GRAN
344 344 Saur saur SAUR
345 345 Knda knda KNDA
346 346 Taml taml TAML
347 347 Mlym mlym MLYM
348 348 Sinh sinh SINH
349 349 Cakm cakm CAKM
350 350 Mymr mymr MYMR
351 351 Lana lana LANA
352 352 Thai thai THAI
353 353 Tale tale TALE
354 354 Talu talu TALU
355 355 Khmr khmr KHMR
356 356 Laoo laoo LAOO
357 357 Kali kali KALI
358 358 Cham cham CHAM
359 359 Tavt tavt TAVT
360 360 Bali bali BALI
361 361 Java java JAVA
362 362 Sund sund SUND
363 363 Rjng rjng RJNG
364 364 Leke leke LEKE
365 365 Batk batk BATK
366 366 Maka maka MAKA
367 367 Bugi bugi BUGI
368 368 Kawi kawi KAWI
370 370 Tglg tglg TGLG
371 371 Hano hano HANO
372 372 Buhd buhd BUHD
373 373 Tagb tagb TAGB
398 398 Sora sora SORA
399 399 Lisu lisu LISU
400 400 Lina lina LINA
401 401 Linb linb LINB
402 402 Cpmn cpmn CPMN
403 403 Cprt cprt CPRT
410 410 Hira hira HIRA
411 411 Kana kana KANA
412 412 Hrkt hrkt HRKT
413 413 Jpan jpan JPAN
420 420 Nkgb nkgb NKGB
430 430 Ethi ethi ETHI
435 435 Bamu bamu BAMU
436 436 Kpel kpel KPEL
437 437 Loma loma LOMA
438 438 Mend mend MEND
439 439 Afak afak AFAK
440 440 Cans cans CANS
445 445 Cher cher CHER
450 450 Hmng hmng HMNG
451 451 Hmnp hmnp HMNP
460 460 Yiii yiii YIII
470 470 Vaii vaii VAII
480 480 Wole wole WOLE
499 499 Nshu nshu NSHU
500 500 Hani hani HANI
501 501 Hans hans HANS
502 502 Hant hant HANT
503 503 Hanb hanb HANB
505 505 Kitl kitl KITL
510 510 Jurc jurc JURC
520 520 Tang tang TANG
530 530 Shui shui SHUI
550 550 Blis blis BLIS
570 570 Brai brai BRAI
610 610 Inds inds INDS
620 620 Roro roro RORO
755 755 Dupl dupl DUPL
900 900 Qaaa qaaa QAAA
949 949 Qabx qabx QABX
993 993 Zsye zsye ZSYE
994 994 Zinh zinh ZINH
995 995 Zmth zmth ZMTH
996 996 Zsym zsym ZSYM
997 997 Zxxx zxxx ZXXX
998 998 Zyyy zyyy ZYYY
999 999 Zzzz zzzz ZZZZ
113 changes: 97 additions & 16 deletions 999999999/999999999.sh
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,49 @@ un_pcode_hxlate_csv_file() {
done < "${csv_input}"
}

#######################################
# Return an 1603.45.49 (UN m49 numeric code) from other common systems
#
# Example:
# un_pcode_hxlate_csv_file AFG_1.csv > AFG_1.hxl.csv
#
# Globals:
# NUMERORDINATIO_DATUM
# Arguments:
# scienciam_codicem
# scienciam_variable_pointer
#######################################
__numerordinatio_scientiam_initiale() {
scienciam_codicem="$1"
scienciam_variable_pointer="$2" # Ponter, https://tldp.org/LDP/abs/html/ivr.html
# _data=$(eval "${scienciam_variable}")
# _data=${scienciam_variable}

# https://tldp.org/LDP/abs/html/ivr.html
# https://stackoverflow.com/a/19634966/894546

echo "----D49-"
echo "$D49"
echo "----D49-"

eval local_variable_content=\$$scienciam_variable_pointer
echo "local_variable_content before $local_variable_content"
# echo "-----"

# eval local_variable_content=\$"$scienciam_variable_pointer"
if [ -z "${local_variable_content}" ]; then
local_variable_content=$(cat "${NUMERORDINATIO_DATUM}/${scienciam_codicem}.tsv")

echo "entrou"
else
echo "error"
fi

echo " ----D49-"
echo " $D49"
echo " ----D49-"
# return 0
}

__numerordinatio_codicem_lineam() {
lineam="$1"
Expand All @@ -433,39 +476,73 @@ __numerordinatio_codicem_lineam() {
# Return an 1603.45.49 (UN m49 numeric code) from other common systems
#
# Example:
# un_pcode_hxlate_csv_file AFG_1.csv > AFG_1.hxl.csv
# # > 76
# numerordinatio_codicem_locali__1603_45_49 "BRA"
#
# Globals:
# NUMERORDINATIO_DATUM
# NUMERORDINATIO_DATUM__1603_45_49
# Arguments:
# csv_input
# csv_hxlated_output
# terminum
#######################################
numerordinatio_codicem_locali__1603_45_49() {
terminum="$1"
referens="${NUMERORDINATIO_DATUM}/1603.45.49.tsv"
codicem_locali=""
# csv_hxlated_output="$1"
# csv_header=$(head -n 1 "${csv_input}")

if [ -z "${terminum}" ]; then
echo ""
fi

while IFS= read -r line; do
echo "$NUMERORDINATIO_DATUM__1603_45_49" | while IFS= read -r line; do
codicem_locali=$(__numerordinatio_codicem_lineam "$line")
if [ -n "$codicem_locali" ]; then
echo "$codicem_locali"
return 0
fi
# echo "line $line"
done
# echo "none for $terminum"
}

#######################################
# Return an 1603.45.49 (UN m49 numeric code) from other common systems
# TODO:
# Create numeric codes
#
# Example:
# # > 76
# numerordinatio_codicem_locali__1603_47_639_3 "pt"
#
# Globals:
# NUMERORDINATIO_DATUM__1603_47_639_3
# Arguments:
# terminum
#######################################
numerordinatio_codicem_locali__1603_47_639_3() {
terminum="$1"
codicem_locali=""

echo "$NUMERORDINATIO_DATUM__1603_47_639_3" | while IFS= read -r line; do
codicem_locali=$(__numerordinatio_codicem_lineam "$line")
if [ -n "$codicem_locali" ]; then
echo "$codicem_locali"
return 0
fi
done < "${referens}"
echo "none for $terminum"
# echo "line $line"
done
# echo "none for $terminum"
}

# https://superuser.com/questions/279141/why-is-reading-a-file-faster-than-reading-a-variable
NUMERORDINATIO_DATUM__1603_45_49=$(cat "${NUMERORDINATIO_DATUM}/1603.45.49.tsv")
NUMERORDINATIO_DATUM__1603_47_639_3=$(cat "${NUMERORDINATIO_DATUM}/1603.47.639.3.tsv")
# numerordinatio_codicem_locali__1603_45_49 "br"
# numerordinatio_codicem_locali__1603_45_49 "BRA"
# numerordinatio_codicem_locali__1603_45_49 "zmb"
numerordinatio_codicem_locali__1603_45_49 "BRA"
numerordinatio_codicem_locali__1603_45_49 "SWZ"
numerordinatio_codicem_locali__1603_45_49 "SWZ"
numerordinatio_codicem_locali__1603_45_49 "SWZ"
numerordinatio_codicem_locali__1603_45_49 "SAU"

echo ""
numerordinatio_codicem_locali__1603_47_639_3 "pt"
numerordinatio_codicem_locali__1603_47_639_3 "es"
numerordinatio_codicem_locali__1603_47_639_3 "en"

# numerordinatio_codicem_locali__1603_45_49 "zmb"
# numerordinatio_codicem_locali__1603_45_49 "zmb"
# numerordinatio_codicem_locali__1603_45_49 "zmb"
Expand All @@ -480,6 +557,10 @@ numerordinatio_codicem_locali__1603_45_49() {
# numerordinatio_codicem_locali__1603_45_49 "zmb"
# numerordinatio_codicem_locali__1603_45_49 "YE"

# D49=""
# __numerordinatio_scientiam_initiale "1603.45.49" "D49"
# __numerordinatio_scientiam_initiale "1603.45.49" "D49"

# un_pcode_rawheader_admin_level "admin2Pcode" || echo "admin2Pcode no admin of pcode"
# un_pcode_rawheader_admin_level "admin2Pcode" && echo "admin2Pcode is admin of pcode"
# un_pcode_rawheader_admin_level "admin2AltName2_zh" || echo "admin2AltName2_zh no admin of pcode"
Expand Down

0 comments on commit f4e093d

Please sign in to comment.