Files
CSV2ANKI/plural.py
2025-06-29 16:10:14 +02:00

171 lines
6.6 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import genanki
cards = [
{
"Deutsch": "das Mädchen",
"SingularUnbestimmt": "en flicka",
"PluralUnbestimmt": "flickor",
"SingularBestimmt": "flickan",
"PluralBestimmt": "flickorna",
"Erklärung": "<b>Deklinationsgruppe 1</b></br>"
"Plural endet auf <span style='color:red;'>-or</span></br></br>"
"Substantive, die der ersten Deklinationsgruppe angehören, sind ausschließlich "
"<span style='color:red;'>en</span>-Wörter, also Utra.</br></br>"
"Folgende Merkmale weisen auf Substantive dieser Gruppe hin:</br>"
"<ul><li>viele <span style='color:red;'>en</span>-Wörter, deren Endung im Singular ein unbetontes <span style='color:red;'>-a</span> ist</li></br>"
"<li>einige <span style='color:red;'>en</span>-Wörter, die nicht auf <span style='color:red;'>-a</span> enden</li></br>"
},
{
"Deutsch": "der Junge",
"SingularUnbestimmt": "en pojke",
"SingularBestimmt": "pojken",
"PluralUnbestimmt": "pojkar",
"PluralBestimmt": "pojkarna",
"Erklärung": "<b>Deklinationsgruppe 2</b></br>"
"Plural endet auf <span style='color:red;'>-ar</span></br></br>"
"Der zweiten Deklinationsgruppe gehören <b>ausschließlich</b> <span style='color:red;'>en</span>-Wörter, also Utra, an.</br>"
"</br>Welche Substantive gehören zur Gruppe 2:"
"<ul><li>einsilbige en-Wörter mit Endung auf einen Konsonanten</li>"
"<li><span style='color:red;'>en</span>-Wörter mit Endung auf <span style='color:red;'>-e</span></li>"
"<li><span style='color:red;'>en</span>-Wörter, die auf <span style='color:red;'>-el</span>, <span style='color:red;'>-en</span>, <span style='color:red;'>-er</span>, <span style='color:red;'>-dom</span>, <span style='color:red;'>-ing</span>, <span style='color:red;'>-lek</span> enden</li></ul>"
"Folgendermaßen lautet die Pluralendung der Substantive dieser Gruppe:</br>"
"<ul>"
"<li>die Substantive enden in <b>unbestimmter</b> Form Plural auf <span style='color:red;'>-ar</span></br></li>"
"<li>die Substantive enden in <b>bestimmter</b> Form Plural auf <span style='color:red;'>-arna</span></br></li>"
"<li>in der Pluralendung fällt das <span style='color:red;'>-e</span> (der Singular-Endung) weg</br></li>"
"<li>manchmal kommt es zu einer Vokaländerung, dabei wird <span style='color:red;'>o</span> (im Wortstamm) zu <span style='color:red;'>ö</span> bzw. <span style='color:red;'>a</span> zu <span style='color:red;'>ä.</span></br></li></ul>"
},
{
"Deutsch": "der Student",
"SingularUnbestimmt": "en student",
"SingularBestimmt": "studenten",
"PluralUnbestimmt": "studenter",
"PluralBestimmt": "studenterna",
"Erklärung": "<b>Deklinationsgruppe 3</b></br>"
"Plural endet auf <span style='color:red;'>-(e)r</span></br>"
"Der dritten Konjugationsgruppe gehören einsilbige <span style='color:red;'>en</span>-Wörter (Utra) an, aber auch ein <b>paar</b> <span style='color:red;'>ett</span>-Wörter (Neutra) werden dieser Gruppe zugeordnet."
"Welche Substantive gehören zur Gruppe 3:"
"<ul><li>einsilbige <span style='color:red;'>en</span>-Wörter mit Endung auf einen Konsonanten</li>"
" <li>Substantive mit Endung auf Konsonant</li>"
" <li>einige Substantive, die als Lehnwörter anderen Sprachen entnommen wurden</li>"
" <li>einige Substantive, die auf einen Vokal enden</li></ul>"
"Folgendermaßen lautet die Pluralendung der Substantive dieser Gruppe:"
"<ul><li>die Substantive enden in <b>unbestimmter</b> Form Plural auf -<span style='color:red;'>er</span></li>"
"<li>die Substantive enden in <b>bestimmter</b> Form Plural auf -<span style='color:red;'>erna</span></li>"
"<li>es kann zu Vokaländerungen kommen, dann wird: <span style='color:red;'>a</span> zu <span style='color:red;'>ä</span> oder <span style='color:red;'>o</span> zu <span style='color:red;'>ö</span></li>"
"<li>Substantive, die auf einen Vokalenden, erhalten in <b>unbestimmter</b> Form Plural nur die Endung -<span style='color:red;'>r</span></li>"
"<li>Substantive, die auf einen Vokal enden, erhalten in <b>bestimmter</b> Form Plural die Endung -<span style='color:red;'>rna</span></li></ul>"
},
# {
# "Deutsch": "der Apfel",
# "SingularUnbestimmt": "ett äpple",
# "SingularBestimmt": "äpplet",
# "PluralUnbestimmt": "äpplen",
# "PluralBestimmt": "äpplena",
# "Erklärung": "Gruppe 4: ett-Wörter auf -e. Pluralendung: -n (unbestimmt), -na (bestimmt)."
# },
# {
# "Deutsch": "das Kind",
# "SingularUnbestimmt": "ett barn",
# "SingularBestimmt": "barnet",
# "PluralUnbestimmt": "barn",
# "PluralBestimmt": "barnen",
# "Erklärung": "Gruppe 5: unregelmäßige oder unveränderte Wörter, z.B. ett-Wörter auf Konsonant."
# },
]
model = genanki.Model(
1607392319,
'Schwedisch Pluralformen Modell',
fields=[
{'name': 'Deutsch'},
{'name': 'SingularUnbestimmt'},
{'name': 'PluralUnbestimmt'},
{'name': 'SingularBestimmt'},
{'name': 'PluralBestimmt'},
{'name': 'Erklärung'},
],
templates=[
{
'name': 'Karte 1',
'qfmt': """
<table style="width: 100%; border-collapse: collapse; text-align: center;">
<thead>
<tr>
<th>Deutsch</th>
<th>Unbestimmt Sg.</th>
<th>Unbestimmt Pl.</th>
<th>Bestimmt Sg.</th>
<th>Bestimmt Pl.</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{Deutsch}}</td>
<td>{{SingularUnbestimmt}}</td>
<td>{{PluralUnbestimmt}}</td>
<td>{{SingularBestimmt}}</td>
<td>{{PluralBestimmt}}</td>
</tr>
</tbody>
</table>
""",
'afmt': """
{{FrontSide}}
<hr>
<div style="padding: 10px; font-size: 1.1em;">
<!-- strong>Erklärung:</strong><br-->
{{Erklärung}}
</div>
""",
},
],
css="""
table {
border: 1px solid #ccc;
background-color: #f9f9f9;
}
th, td {
border: 1px solid #ccc;
padding: 8px;
}
th {
background-color: #e0e0e0;
}
""",
)
deck = genanki.Deck(
2059400110,
'Pluralformen'
)
for card in cards:
note = genanki.Note(
model=model,
fields=[
card['Deutsch'],
card['SingularUnbestimmt'],
card['PluralUnbestimmt'],
card['SingularBestimmt'],
card['PluralBestimmt'],
card['Erklärung']
]
)
deck.add_note(note)
genanki.Package(deck).write_to_file('schwedisch_pluralgruppen.apkg')
print("Fertig: schwedisch_pluralgruppen.apkg")