Skip to content

Commit

Permalink
#10: testum/de-extraneum/, testum/de-hxl/, testum/de-csv/
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Nov 28, 2021
1 parent 4a0d186 commit 2ee571d
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 9 deletions.
3 changes: 2 additions & 1 deletion bin/hxltmcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5716,7 +5716,8 @@ def initialle(self, strictum: bool): # pylint: disable=too-many-branches
# ValueError: not enough values to unpack (expected 2, got 1)
if self.linguam.find('-') == -1:
raise ValueError(
'HXLTMLinguam zzz-Zzzz? [{0}]'.format(str(self.linguam)))
'HXLTMLinguam zzz-Zzzz? [{0}] Archivum est HXLTM?'.format(
str(self.linguam)))

self.iso6393, self.iso115924 = \
list(self.linguam.split('-'))
Expand Down
7 changes: 0 additions & 7 deletions testum/csv-3-exemplum.csv

This file was deleted.

7 changes: 7 additions & 0 deletions testum/de-csv/csv-non-hxltm-exemplum.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
id,en,pt
1,UN,ONU
2,United Nations,Organização das Nações Unidas
3,IFRC,FICV/CV
4,International Federation of Red Cross and Red Crescent Societies ,Federação Internacional das Sociedades da Cruz Vermelha e do Crescente Vermelho
5,AI,AI
6,Amnesty International,Amnistia Internacional
8 changes: 8 additions & 0 deletions testum/de-extraneum/hxltm-bi-linguam-in-columnam.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
id,source language,target language,source term,target term
#item+conceptum+codicem,#item+terminum+est_linguam_fontem,#item+terminum+est_linguam_objectivum,#item+terminum+de_linguam_fontem,#item+terminum+de_linguam_objectivum
1,eng-Latn,por-Latn,UN,ONU
2,eng-Latn,por-Latn,United Nations,Organização das Nações Unidas
3,eng-Latn,por-Latn,IFRC,FICV/CV
4,eng-Latn,por-Latn,International Federation of Red Cross and Red Crescent Societies ,Federação Internacional das Sociedades da Cruz Vermelha e do Crescente Vermelho
5,eng-Latn,por-Latn,AI,AI
6,eng-Latn,por-Latn,Amnesty International,Amnistia Internacional
14 changes: 14 additions & 0 deletions testum/de-extraneum/hxltm-multi-linguam-in-columnam.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
id,lang,term
#item+conceptum+codicem,#item+terminum+est_linguam,#item+terminum+de_linguam
1,eng-Latn,UN
2,eng-Latn,United Nations
3,eng-Latn,IFRC
4,eng-Latn,International Federation of Red Cross and Red Crescent Societies
5,eng-Latn,AI
6,por-Latn,Amnistia Internacional
1,por-Latn,ONU
2,por-Latn,Organização das Nações Unidas
3,por-Latn,FICV/CV
4,por-Latn,Federação Internacional das Sociedades da Cruz Vermelha e do Crescente Vermelho
5,por-Latn,AI
6,por-Latn,Amnistia Internacional
8 changes: 8 additions & 0 deletions testum/de-extraneum/hxltm-solum-id.tm.hxl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
id
#item+conceptum+codicem
1
2
3
4
5
6
8 changes: 8 additions & 0 deletions testum/de-extraneum/hxltm-solum-linguam.tm.hxl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
en,pt
#item+terminum+i_en+i_eng+is_latn+rem,#item+terminum+i_pt+i_por+is_latn+rem
UN,ONU
United Nations,Organização das Nações Unidas
IFRC,FICV/CV
International Federation of Red Cross and Red Crescent Societies ,Federação Internacional das Sociedades da Cruz Vermelha e do Crescente Vermelho
AI,AI
Amnesty International,Amnistia Internacional
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
id,en,pt
#vocab+id,#vocab+term+i_en,#vocab+term+i_pt
1,UN,ONU
2,United Nations,Organização das Nações Unidas
Expand Down
54 changes: 54 additions & 0 deletions testum/disciplinam-manuale-anglicum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,60 @@ hxltmdexml --help > "hxltmdexml--help_eng-Latn.txt"
# fi
### TODO: implement some way to also validate all CSVs on folder


# tag::HXLStandard_examples[]
### I -------------------------------------------------------------------------

### I -------------------------------------------------------------------------
# _[eng-Latn]
# Convert a file in CSV to HXLTM (using HXLStandard tools): use hxltag
# [eng-Latn]_

# head -n 2 de-csv/csv-non-hxltm-exemplum.csv
# id,en,pt
# 1,UN,ONU

hxltag \
--map='id #item+conceptum+codicem' \
--map='en #item+terminum+i_en+i_eng+is_latn+rem' \
--map='pt #item+terminum+i_pt+i_por+is_latn+rem' \
de-csv/csv-non-hxltm-exemplum.csv \
resultatum/de-csv/csv-non-hxltm-exemplum.tm.hxl.csv

# head -n 2 resultatum/de-csv/csv-non-hxltm-exemplum.tm.hxl.csv
# id,en,pt
# #item+conceptum+codicem,#item+terminum+i_en+i_eng+is_latn+rem,
# #item+terminum+i_pt+i_por+is_latn+rem

### II -------------------------------------------------------------------------
# _[eng-Latn]
# Convert a file already in HXL, but not in HXLTM, to HXLTM: use hxlrename
# [eng-Latn]_

# head -n 2 hxl/hxl-non-hxltm-exemplum.hxl.csv
# id,en,pt
# #vocab+id,#vocab+term+i_en,#vocab+term+i_pt

hxlrename \
--rename='vocab+id:item+conceptum+codicem' \
--rename='vocab+term+i_en:item+terminum+i_en+i_eng+is_latn+rem' \
--rename='vocab+term+i_pt:item+terminum+i_pt+i_por+is_latn+rem' \
de-hxl/hxl-non-hxltm-exemplum.hxl.csv \
resultatum/de-hxl/hxl-non-hxltm-exemplum.tm.hxl.csv

# head -n 2 resultatum/de-hxl-non-hxltm/hxl-non-hxltm-exemplum.tm.hxl.csv
# id,en,pt
# #item+conceptum+codicem,#item+terminum+i_en+i_eng+is_latn+rem,
# #item+terminum+i_pt+i_por+is_latn+rem

# end::HXLStandard_examples[]

# Temp, remove
# hxlcut --include='#item+codicem' resultatum/de-hxl/hxl-non-hxltm-exemplum.tm.hxl.csv > de-extraneum/hxltm-solum-id.tm.hxl.csv
# hxlcut --include='#item+terminum' resultatum/de-hxl/hxl-non-hxltm-exemplum.tm.hxl.csv > de-extraneum/hxltm-solum-linguam.tm.hxl.csv
# hxltmcli de-extraneum/hxltm-solum-id.tm.hxl.csv
# hxltmcli de-extraneum/hxltm-solum-linguam.tm.hxl.csv

# tag::HXLTM_CSV[]
### I -------------------------------------------------------------------------
# _[eng-Latn]
Expand Down
2 changes: 1 addition & 1 deletion testum/hxltmcli--help_eng-Latn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ optional arguments:
formats (like TBX) both to avoid scan the source file
and to be sure about HXL attributes of the output
format. Default: indicem_de_terminum,meta. Options:
[annotationem annotationem_linguam
[accuratum annotationem annotationem_linguam
annotationem_terminum codicem codicem_conceptum
dominium indicem_de_terminum meta meta_conceptum
meta_linguam meta_terminum rem]
Expand Down
8 changes: 8 additions & 0 deletions testum/resultatum/de-csv/csv-non-hxltm-exemplum.tm.hxl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
id,en,pt
#item+conceptum+codicem,#item+terminum+i_en+i_eng+is_latn+rem,#item+terminum+i_pt+i_por+is_latn+rem
1,UN,ONU
2,United Nations,Organização das Nações Unidas
3,IFRC,FICV/CV
4,International Federation of Red Cross and Red Crescent Societies ,Federação Internacional das Sociedades da Cruz Vermelha e do Crescente Vermelho
5,AI,AI
6,Amnesty International,Amnistia Internacional
8 changes: 8 additions & 0 deletions testum/resultatum/de-hxl/hxl-non-hxltm-exemplum.tm.hxl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
id,en,pt
#item+conceptum+codicem,#item+terminum+i_en+i_eng+is_latn+rem,#item+terminum+i_pt+i_por+is_latn+rem
1,UN,ONU
2,United Nations,Organização das Nações Unidas
3,IFRC,FICV/CV
4,International Federation of Red Cross and Red Crescent Societies ,Federação Internacional das Sociedades da Cruz Vermelha e do Crescente Vermelho
5,AI,AI
6,Amnesty International,Amnistia Internacional

0 comments on commit 2ee571d

Please sign in to comment.