Update app.py
Browse files
app.py
CHANGED
@@ -36,23 +36,23 @@ lemmas = load_data()
|
|
36 |
|
37 |
def create_noun_table(lemma, forms):
|
38 |
table_data = {
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
|
|
|
|
|
|
44 |
}
|
45 |
|
46 |
for form in forms:
|
47 |
ppos = form['PPOS'].lower() # Normalize to lowercase
|
48 |
word = form['word']
|
49 |
key = ppos.split('=')[0] # Extracting relevant part of PPOS
|
50 |
-
print(f"Processing: word={word}, ppos={ppos}, key={key}") # Debugging output
|
51 |
if key in table_data:
|
52 |
table_data[key] = word
|
53 |
|
54 |
-
print(f"Final table data for {lemma}: {table_data}") # Debugging output
|
55 |
-
|
56 |
table = f"""
|
57 |
<table border="1">
|
58 |
<thead>
|
@@ -70,27 +70,27 @@ def create_noun_table(lemma, forms):
|
|
70 |
<tbody>
|
71 |
<tr>
|
72 |
<td>{table_data['nsns']}</td>
|
73 |
-
<td>{table_data['
|
74 |
<td>{table_data['npns']}</td>
|
75 |
-
<td>{table_data['
|
76 |
</tr>
|
77 |
<tr>
|
78 |
-
<td>{table_data['
|
79 |
-
<td>{table_data['
|
80 |
-
<td>{table_data['
|
81 |
-
<td>{table_data['
|
82 |
</tr>
|
83 |
<tr>
|
84 |
-
<td>{table_data['
|
85 |
-
<td>{table_data['
|
86 |
-
<td>{table_data['
|
87 |
-
<td>{table_data['
|
88 |
</tr>
|
89 |
<tr>
|
90 |
-
<td>{table_data['
|
91 |
-
<td>{table_data['
|
92 |
-
<td>{table_data['
|
93 |
-
<td>{table_data['
|
94 |
</tr>
|
95 |
</tbody>
|
96 |
</table>
|
@@ -98,10 +98,8 @@ def create_noun_table(lemma, forms):
|
|
98 |
return table
|
99 |
|
100 |
def search_lemma(lemma):
|
101 |
-
print(f"Searching for lemma: {lemma}") # Debugging output
|
102 |
results = lemmas.get(lemma, None)
|
103 |
if not results:
|
104 |
-
print(f"No results found for {lemma}") # Debugging output
|
105 |
return f"No results found for {lemma}"
|
106 |
|
107 |
if 'n' in results[0]['PPOS'].lower():
|
|
|
36 |
|
37 |
def create_noun_table(lemma, forms):
|
38 |
table_data = {
|
39 |
+
'nsns': '', 'nsns==duu': '', 'nsmsn': '', 'nsmsn==duu': '',
|
40 |
+
'nsas': '', 'nsas==duu': '', 'nsds': '', 'nsds==duu': '',
|
41 |
+
'nsgs': '', 'nsgs==dou': '', 'npns': '', 'npns==duu': '',
|
42 |
+
'npas': '', 'npas==duu': '', 'npds': '', 'npds==duu': '',
|
43 |
+
'npgs': '', 'npgs==dou': '', 'ncmsa': '', 'ncmsa==duu': '',
|
44 |
+
'ncmsd': '', 'ncmsd==duu': '', 'ncmsg': '', 'ncmsg==dou': '',
|
45 |
+
'ncmpn': '', 'ncmpn==duu': '', 'ncmpa': '', 'ncmpa==duu': '',
|
46 |
+
'ncmpd': '', 'ncmpd==duu': '', 'ncmpg': '', 'ncmpg==dou': ''
|
47 |
}
|
48 |
|
49 |
for form in forms:
|
50 |
ppos = form['PPOS'].lower() # Normalize to lowercase
|
51 |
word = form['word']
|
52 |
key = ppos.split('=')[0] # Extracting relevant part of PPOS
|
|
|
53 |
if key in table_data:
|
54 |
table_data[key] = word
|
55 |
|
|
|
|
|
56 |
table = f"""
|
57 |
<table border="1">
|
58 |
<thead>
|
|
|
70 |
<tbody>
|
71 |
<tr>
|
72 |
<td>{table_data['nsns']}</td>
|
73 |
+
<td>{table_data['nsns==duu']}</td>
|
74 |
<td>{table_data['npns']}</td>
|
75 |
+
<td>{table_data['npns==duu']}</td>
|
76 |
</tr>
|
77 |
<tr>
|
78 |
+
<td>{table_data['nsas']}</td>
|
79 |
+
<td>{table_data['nsas==duu']}</td>
|
80 |
+
<td>{table_data['npas']}</td>
|
81 |
+
<td>{table_data['npas==duu']}</td>
|
82 |
</tr>
|
83 |
<tr>
|
84 |
+
<td>{table_data['nsds']}</td>
|
85 |
+
<td>{table_data['nsds==duu']}</td>
|
86 |
+
<td>{table_data['npds']}</td>
|
87 |
+
<td>{table_data['npds==duu']}</td>
|
88 |
</tr>
|
89 |
<tr>
|
90 |
+
<td>{table_data['nsgs']}</td>
|
91 |
+
<td>{table_data['nsgs==dou']}</td>
|
92 |
+
<td>{table_data['npgs']}</td>
|
93 |
+
<td>{table_data['npgs==dou']}</td>
|
94 |
</tr>
|
95 |
</tbody>
|
96 |
</table>
|
|
|
98 |
return table
|
99 |
|
100 |
def search_lemma(lemma):
|
|
|
101 |
results = lemmas.get(lemma, None)
|
102 |
if not results:
|
|
|
103 |
return f"No results found for {lemma}"
|
104 |
|
105 |
if 'n' in results[0]['PPOS'].lower():
|