Closed ctrlcctrlv closed 3 years ago
This patch gave me usable output.
diff --git a/lib/hyperglot/main.py b/lib/hyperglot/main.py
index 02df9c6..2a61618 100644
--- a/lib/hyperglot/main.py
+++ b/lib/hyperglot/main.py
@@ -149,9 +149,8 @@ def write_yaml(file, data):
for script, languages in langs_by_status.items():
if path not in write:
write[path] = {}
- # Coerce l back to dict from type Language
- languages = {iso: dict(l) for iso, l in languages.items()}
- write[path].update(languages)
+ languages = dict(languages)
+ write[path].update({script: languages})
if len(data.keys()) == 1:
# Single file input, write directly to top level by re-writing the
# output dict without the filename level
Looks like:
...
eng:
name: English
orthographies:
- autonym: English
auxiliary: Á Ç È É Ê Ë Ï Ñ Ô Ö á ç è é ê ë ï ñ ô ö
base: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Æ Œ a b c d e f g h i j k l m n o p q r s t u v w x y z æ œ
script: Latin
status: primary
source:
- Omniglot
- Wikipedia
- CLDR
- Alvestrand
speakers: 400000000
speakers_date: 2006
status: living
validity: preliminary
ese:
name: Ese Ejja
orthographies:
- base: B P D T K S J C M N Y W Ñ b p d t k s j c m n y w ñ
marks: ̃
script: Latin
status: primary
source:
- Wikipedia
speakers: 700
speakers_date: 2007
validity: draft
eus:
name: Basque
orthographies:
- autonym: Euskara
base: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Ñ Ü a b c d e f g h i j k l m n o p q r s t u v w x y z ñ ü
marks: ̃ ̈
script: Latin
status: primary
source:
- Omniglot
- Wikipedia
speakers: 750000
speakers_date: 2016
status: living
validity: verified
fao:
name: Faroese
orthographies:
- autonym: Føroyskt
base: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Á Å Æ Í Ð Ó Ø Ú Ý a b c d e f g h i j k l m n o p q r s t u v w x y z á å æ í ð ó ø ú ý
marks: ́ ̊
script: Latin
status: primary
source:
- Omniglot
- Wikipedia
speakers: 72000
speakers_date: 2007
status: living
validity: verified
fij:
name: Fijian
orthographies:
- autonym: Vakaviti
base: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z
script: Latin
status: primary
source:
- Omniglot
- Wikipedia
speakers: 339210
speakers_date: 1996
status: living
validity: verified
...
No idea what the intended format was, but this works for me.
Thanks, I'll take a look at this shortly.
Thanks again for the report. We had previously saved the yaml data split by support level (base, aux) and there was left over code that broke the saving. If you update the package now with pip install --upgrade hyperglot
it should output correctly.