Add declension type field (#110)
Browse files- README.md +1 -0
- german.yaml +117 -1
- huggingface/german_parser.py +14 -1
README.md
CHANGED
@@ -380,6 +380,7 @@ declension table of the following template:
|
|
380 |
- term:
|
381 |
definition:
|
382 |
audio:
|
|
|
383 |
declension:
|
384 |
- ["", singular, plural]
|
385 |
- [nominative, ████████, ██████]
|
|
|
380 |
- term:
|
381 |
definition:
|
382 |
audio:
|
383 |
+
declension-type: weak/strong
|
384 |
declension:
|
385 |
- ["", singular, plural]
|
386 |
- [nominative, ████████, ██████]
|
german.yaml
CHANGED
@@ -92,6 +92,18 @@ vocabulary:
|
|
92 |
- [genitive, keines, keiner, keines, keiner]
|
93 |
- [dative, keinem, keiner, keinem, keinen]
|
94 |
- [accusative, keinen, keine, kein, keine ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
- term: man
|
96 |
definition:
|
97 |
- (pron.) one
|
@@ -5621,6 +5633,13 @@ vocabulary:
|
|
5621 |
- term: gewinnen
|
5622 |
definition: to win
|
5623 |
audio: https://upload.wikimedia.org/wikipedia/commons/f/f8/De-gewinnen2.ogg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5624 |
- term: erschießen
|
5625 |
definition: to shoot dead
|
5626 |
audio: https://upload.wikimedia.org/wikipedia/commons/4/4e/De-erschie%C3%9Fen.ogg
|
@@ -5649,6 +5668,7 @@ vocabulary:
|
|
5649 |
- term: der Befehl
|
5650 |
definition: the command
|
5651 |
audio: https://upload.wikimedia.org/wikipedia/commons/a/ac/De-Befehl.ogg
|
|
|
5652 |
declension:
|
5653 |
- ["", singular, plural ]
|
5654 |
- [nominative, Befehl, Befehle ]
|
@@ -5946,6 +5966,94 @@ vocabulary:
|
|
5946 |
- in front of that/it
|
5947 |
- from that/it
|
5948 |
audio: https://upload.wikimedia.org/wikipedia/commons/3/33/De-davor.ogg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5949 |
|
5950 |
|
5951 |
|
@@ -6072,9 +6180,17 @@ vocabulary:
|
|
6072 |
- term: elementar
|
6073 |
definition: elemental, fundamental
|
6074 |
- term: die Lehre
|
6075 |
-
definition:
|
|
|
|
|
6076 |
- term: erste
|
6077 |
definition: (adj.) first
|
|
|
|
|
|
|
|
|
|
|
|
|
6078 |
- term: die Faust
|
6079 |
definition: the first
|
6080 |
declension:
|
|
|
92 |
- [genitive, keines, keiner, keines, keiner]
|
93 |
- [dative, keinem, keiner, keinem, keinen]
|
94 |
- [accusative, keinen, keine, kein, keine ]
|
95 |
+
- term: keiner
|
96 |
+
definition:
|
97 |
+
- (pron.) nobody
|
98 |
+
- (pron.) none
|
99 |
+
- (pron.) neither
|
100 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/1/1c/De-keiner.ogg
|
101 |
+
declension:
|
102 |
+
- ["", masclune, feminine, neuter, plural]
|
103 |
+
- [nominative, keiner, keine, "keines, keins", keine ]
|
104 |
+
- [genitive, keines, keiner, keines, keiner]
|
105 |
+
- [dative, keinem, keiner, keinem, keinen]
|
106 |
+
- [accusative, keinen, keine, "keines, keins", keine ]
|
107 |
- term: man
|
108 |
definition:
|
109 |
- (pron.) one
|
|
|
5633 |
- term: gewinnen
|
5634 |
definition: to win
|
5635 |
audio: https://upload.wikimedia.org/wikipedia/commons/f/f8/De-gewinnen2.ogg
|
5636 |
+
- term: schießen
|
5637 |
+
definition: to shoot
|
5638 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/0/09/De-schie%C3%9Fen.ogg
|
5639 |
+
verbformen:
|
5640 |
+
video: https://youtu.be/seK-ANwvGco
|
5641 |
+
conjugation: https://www.verbformen.com/conjugation/schies5en_hat.pdf
|
5642 |
+
flashcards: https://www.verbformen.com/conjugation/worksheets-exercises/lernkarten/schies5en_hat.pdf
|
5643 |
- term: erschießen
|
5644 |
definition: to shoot dead
|
5645 |
audio: https://upload.wikimedia.org/wikipedia/commons/4/4e/De-erschie%C3%9Fen.ogg
|
|
|
5668 |
- term: der Befehl
|
5669 |
definition: the command
|
5670 |
audio: https://upload.wikimedia.org/wikipedia/commons/a/ac/De-Befehl.ogg
|
5671 |
+
declension-type: strong
|
5672 |
declension:
|
5673 |
- ["", singular, plural ]
|
5674 |
- [nominative, Befehl, Befehle ]
|
|
|
5966 |
- in front of that/it
|
5967 |
- from that/it
|
5968 |
audio: https://upload.wikimedia.org/wikipedia/commons/3/33/De-davor.ogg
|
5969 |
+
- term: die Meldung
|
5970 |
+
definition:
|
5971 |
+
- the report
|
5972 |
+
- the notification
|
5973 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/2/2a/De-Meldung.ogg
|
5974 |
+
declension:
|
5975 |
+
- ["", singular, plural ]
|
5976 |
+
- [nominative, Meldung, Meldungen]
|
5977 |
+
- [genitive, Meldung, Meldungen]
|
5978 |
+
- [dative, Meldung, Meldungen]
|
5979 |
+
- [accusative, Meldung, Meldungen]
|
5980 |
+
- term: der Sicherheitsdienst
|
5981 |
+
definition: the security service
|
5982 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/7/79/De-Sicherheitsdienst.ogg
|
5983 |
+
declension:
|
5984 |
+
- ["", singular, plural ]
|
5985 |
+
- [nominative, Sicherheitsdienst, Sicherheitsdienste ]
|
5986 |
+
- [genitive, "Sicherheitsdienstes, Sicherheitsdiensts", Sicherheitsdienste ]
|
5987 |
+
- [dative, Sicherheitsdienst, Sicherheitsdiensten]
|
5988 |
+
- [accusative, Sicherheitsdienst, Sicherheitsdienste ]
|
5989 |
+
- term: die Säuberungsaktion
|
5990 |
+
definition:
|
5991 |
+
- the purge
|
5992 |
+
- the cleanup
|
5993 |
+
audio: https://www.verbformen.de/deklination/substantive/grundform/der_Sa3uberungsaktion.mp3
|
5994 |
+
declension:
|
5995 |
+
- ["", singular, plural ]
|
5996 |
+
- [nominative, Säuberungsaktion, Säuberungsaktionen]
|
5997 |
+
- [genitive, Säuberungsaktion, Säuberungsaktionen]
|
5998 |
+
- [dative, Säuberungsaktion, Säuberungsaktionen]
|
5999 |
+
- [accusative, Säuberungsaktion, Säuberungsaktionen]
|
6000 |
+
- term: der Partisan
|
6001 |
+
definition: the partisan
|
6002 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/8/81/De-Partisan.ogg
|
6003 |
+
declension-type: weak
|
6004 |
+
declension:
|
6005 |
+
- ["", singular, plural ]
|
6006 |
+
- [nominative, Partisan, Partisanen]
|
6007 |
+
- [genitive, Partisanen, Partisanen]
|
6008 |
+
- [dative, Partisanen, Partisanen]
|
6009 |
+
- [accusative, Partisanen, Partisanen]
|
6010 |
+
- term: durchführen
|
6011 |
+
definition:
|
6012 |
+
- to perform
|
6013 |
+
- to conduct
|
6014 |
+
- to implement
|
6015 |
+
- to carry out
|
6016 |
+
- to execute
|
6017 |
+
- to put into action
|
6018 |
+
audio:
|
6019 |
+
verbformen:
|
6020 |
+
video: https://youtu.be/GTaswCjpdXA
|
6021 |
+
conjugation: https://www.verbformen.com/conjugation/durchfu3hren.pdf
|
6022 |
+
flashcards: https://www.verbformen.com/conjugation/worksheets-exercises/lernkarten/durchfu3hren.pdf
|
6023 |
+
- term: lauten
|
6024 |
+
definition: to read
|
6025 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/1/17/De-lauten.ogg
|
6026 |
+
verbformen:
|
6027 |
+
conjugation: https://www.verbformen.com/conjugation/lauten.pdf
|
6028 |
+
flashcards: https://www.verbformen.com/conjugation/worksheets-exercises/lernkarten/lauten.pdf
|
6029 |
+
- term: raus
|
6030 |
+
definition: (adv.) out
|
6031 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/8/8f/De-raus.ogg
|
6032 |
+
- term: arbeitslos
|
6033 |
+
definition: (adj.) unemployed
|
6034 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/5/58/De-arbeitslos.ogg
|
6035 |
+
- term: der Wald
|
6036 |
+
definition:
|
6037 |
+
- forest
|
6038 |
+
- woods
|
6039 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/3/30/De-Wald2.ogg
|
6040 |
+
declension-type: strong
|
6041 |
+
declension:
|
6042 |
+
- ["", singular, plural ]
|
6043 |
+
- [nominative, Wald, Wälder ]
|
6044 |
+
- [genitive, "Waldes, Walds", Wälder ]
|
6045 |
+
- [dative, Wald, Wäldern]
|
6046 |
+
- [accusative, Wald, Wälder ]
|
6047 |
+
- term: jagen
|
6048 |
+
definition:
|
6049 |
+
- to hunt
|
6050 |
+
- to chase
|
6051 |
+
- to thrust
|
6052 |
+
- to pierce
|
6053 |
+
audio: https://upload.wikimedia.org/wikipedia/commons/d/d0/De-jagen.ogg
|
6054 |
+
verbformen:
|
6055 |
+
conjugation: https://www.verbformen.com/conjugation/jagen_hat.pdf
|
6056 |
+
flashcards: https://www.verbformen.com/conjugation/worksheets-exercises/lernkarten/jagen_hat.pdf
|
6057 |
|
6058 |
|
6059 |
|
|
|
6180 |
- term: elementar
|
6181 |
definition: elemental, fundamental
|
6182 |
- term: die Lehre
|
6183 |
+
definition:
|
6184 |
+
- theory
|
6185 |
+
- doctrine
|
6186 |
- term: erste
|
6187 |
definition: (adj.) first
|
6188 |
+
- term: erst
|
6189 |
+
definition:
|
6190 |
+
- (adv.) first
|
6191 |
+
- (adv.) only
|
6192 |
+
- (adv.) not until
|
6193 |
+
audio:
|
6194 |
- term: die Faust
|
6195 |
definition: the first
|
6196 |
declension:
|
huggingface/german_parser.py
CHANGED
@@ -109,4 +109,17 @@ def get_declension_attributes(word: object) -> dict[str, str]:
|
|
109 |
for j, col in enumerate(row):
|
110 |
declension_attributes[f"{declension_type}-{i}-{j}"] = declension_table[i][j]
|
111 |
|
112 |
-
return declension_attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
for j, col in enumerate(row):
|
110 |
declension_attributes[f"{declension_type}-{i}-{j}"] = declension_table[i][j]
|
111 |
|
112 |
+
return get_declension_type_attributes(word) | declension_attributes
|
113 |
+
|
114 |
+
|
115 |
+
def get_declension_type_attributes(word: object) -> dict[str, str]:
|
116 |
+
"""
|
117 |
+
Returns the declension type of delinable word as a single-entry dictionary.
|
118 |
+
|
119 |
+
The word must have a "declension-type" field, otherwise an empty dictionary is returned.
|
120 |
+
|
121 |
+
:param word: A vocabulary represented in YAML dictionary which has a "declension-type" key
|
122 |
+
|
123 |
+
:return: a single-entry map
|
124 |
+
"""
|
125 |
+
return {"declension type": word["declension-type"]} if "declension-type" in word else {}
|