unijoh commited on
Commit
1dbd5b2
·
verified ·
1 Parent(s): a4755c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -108,7 +108,6 @@ CSS = """
108
  border: 0 !important;
109
  box-shadow: none !important;
110
  }
111
- #input_col [class*="border"], #input_col [class*="shadow"]{ border:0 !important; box-shadow:none !important; }
112
  """
113
 
114
  # ----------------------------
@@ -250,6 +249,11 @@ def analysis_text(vec: torch.Tensor, lang: str) -> str:
250
  tag = vector_to_tag(vec)
251
  wc = wc_code(vec)
252
 
 
 
 
 
 
253
  if tag == "DGd":
254
  return "fyriseting" if lang=="fo" else "preposition"
255
 
@@ -275,6 +279,12 @@ def analysis_text(vec: torch.Tensor, lang: str) -> str:
275
  c = group_code(vec, g)
276
  if not c:
277
  continue
 
 
 
 
 
 
278
  if wc in {"P","C"} and g == "subcategory":
279
  continue
280
  if (wc, g, c) in HIDE_IN_ANALYSIS:
@@ -419,7 +429,7 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
419
  results_hdr = gr.Row(elem_id="results_hdr", visible=True)
420
  with results_hdr:
421
  results_title = gr.Markdown("### Úrslit / Results")
422
- with gr.Row(elem_id="lang_buttons"):
423
  btn_lang_fo_on = gr.Button("Føroyskt", variant="primary", elem_id="lang_fo_on", visible=True)
424
  btn_lang_fo_off = gr.Button("Føroyskt", variant="secondary", elem_id="lang_fo_off", visible=False)
425
  btn_lang_en_on = gr.Button("English", variant="primary", elem_id="lang_en_on", visible=False)
@@ -457,10 +467,11 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
457
  gr.update(value=df_mean),
458
  gr.update(value=overview),
459
  gr.update(visible=True), # expanded_acc
460
- gr.update(visible=show_fo), # fo_on
461
- gr.update(visible=not show_fo),# fo_off
462
- gr.update(visible=show_en), # en_on
463
- gr.update(visible=not show_en),# en_off
 
464
  lang_current,
465
  )
466
 
@@ -490,7 +501,7 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
490
  btn.click(
491
  on_tag,
492
  inputs=[inp, lang_state],
493
- outputs=[state, out_df, out_mean_df, overview_md, expanded_acc,
494
  btn_lang_fo_on, btn_lang_fo_off, btn_lang_en_on, btn_lang_en_off, lang_state],
495
  queue=False,
496
  )
 
108
  border: 0 !important;
109
  box-shadow: none !important;
110
  }
 
111
  """
112
 
113
  # ----------------------------
 
249
  tag = vector_to_tag(vec)
250
  wc = wc_code(vec)
251
 
252
+ # --- ADDED: compute mood_code and skip flag for infinitive/imperative verbs ---
253
+ mood_code = group_code(vec, "mood") if wc == "V" else ""
254
+ skip_empty_verb_feats = (wc == "V" and mood_code in {"I", "M"}) # navnháttur or boðsháttur
255
+ # --- end added ---
256
+
257
  if tag == "DGd":
258
  return "fyriseting" if lang=="fo" else "preposition"
259
 
 
279
  c = group_code(vec, g)
280
  if not c:
281
  continue
282
+
283
+ # --- ADDED: skip only the generic "no" codes for verbs in infinitive/imperative ---
284
+ if skip_empty_verb_feats and g in {"number", "tense", "person"} and c in {"n", "t", "p"}:
285
+ continue
286
+ # --- end added ---
287
+
288
  if wc in {"P","C"} and g == "subcategory":
289
  continue
290
  if (wc, g, c) in HIDE_IN_ANALYSIS:
 
429
  results_hdr = gr.Row(elem_id="results_hdr", visible=True)
430
  with results_hdr:
431
  results_title = gr.Markdown("### Úrslit / Results")
432
+ with gr.Row(elem_id="lang_buttons", visible=False) as lang_buttons_row:
433
  btn_lang_fo_on = gr.Button("Føroyskt", variant="primary", elem_id="lang_fo_on", visible=True)
434
  btn_lang_fo_off = gr.Button("Føroyskt", variant="secondary", elem_id="lang_fo_off", visible=False)
435
  btn_lang_en_on = gr.Button("English", variant="primary", elem_id="lang_en_on", visible=False)
 
467
  gr.update(value=df_mean),
468
  gr.update(value=overview),
469
  gr.update(visible=True), # expanded_acc
470
+ gr.update(visible=True), # lang_buttons_row <-- ADD THIS
471
+ gr.update(visible=show_fo),
472
+ gr.update(visible=not show_fo),
473
+ gr.update(visible=show_en),
474
+ gr.update(visible=not show_en),
475
  lang_current,
476
  )
477
 
 
501
  btn.click(
502
  on_tag,
503
  inputs=[inp, lang_state],
504
+ outputs=[state, out_df, out_mean_df, overview_md, expanded_acc, lang_buttons_row,
505
  btn_lang_fo_on, btn_lang_fo_off, btn_lang_en_on, btn_lang_en_off, lang_state],
506
  queue=False,
507
  )