AIdeaText commited on
Commit
3c51806
·
verified ·
1 Parent(s): a0b6032

Update modules/ui/ui.py

Browse files
Files changed (1) hide show
  1. modules/ui/ui.py +36 -35
modules/ui/ui.py CHANGED
@@ -532,10 +532,10 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
532
  st.markdown(sentence_str)
533
 
534
  # Mostrar análisis de categorías gramaticales # Mostrar análisis morfológico
535
- col1, col2 =st.columns(2)
 
536
 
537
  with col1:
538
-
539
  with st.expander(t['pos_analysis'], expanded=True):
540
  pos_df = pd.DataFrame(advanced_analysis['pos_analysis'])
541
 
@@ -586,26 +586,26 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
586
  'flat': 'plano', 'compound': 'compuesto', 'list': 'lista', 'parataxis': 'parataxis',
587
  'orphan': 'huérfano', 'goeswith': 'va con', 'reparandum': 'reparación', 'punct': 'puntuación'
588
  },
589
-
590
  'en': {
591
- 'ROOT': 'ROOT', 'nsubj': 'nominal subject', 'obj': 'object', 'iobj': 'indirect object', 'csubj': 'clausal subject',
592
- 'ccomp': 'clausal complement', 'xcomp': 'open clausal complement', 'obl': 'oblique', 'vocative': 'vocative', 'expl': 'expletive',
593
- 'dislocated': 'dislocated', 'advcl': 'adverbial clause modifier', 'advmod': 'adverbial modifier', 'discourse': 'discourse element',
594
- 'aux': 'auxiliary', 'cop': 'copula', 'mark': 'marker', 'nmod': 'nominal modifier', 'appos': 'appositional modifier', 'nummod': 'numeric modifier',
595
- 'acl': 'clausal modifier of noun', 'amod': 'adjectival modifier', 'det': 'determiner', 'clf': 'classifier', 'case': 'case marking', 'conj': 'conjunct',
596
- 'cc': 'coordinating conjunction', 'fixed': 'fixed multiword expression', 'flat': 'flat multiword expression', 'compound': 'compound',
597
- 'list': 'list', 'parataxis': 'parataxis', 'orphan': 'orphan', 'goeswith': 'goes with', 'reparandum': 'reparandum', 'punct': 'punctuation'
 
 
598
  },
599
-
600
  'fr': {
601
- 'ROOT': 'RACINE', 'nsubj': 'sujet nominal', 'obj': 'objet', 'iobj': 'objet indirect', 'csubj': 'sujet phrastique',
602
- 'ccomp': 'complément phrastique', 'xcomp': 'complément phrastique ouvert', 'obl': 'oblique', 'vocative': 'vocatif', 'expl': 'explétif',
603
- 'dislocated': 'disloqué', 'advcl': 'clause adverbiale', 'advmod': 'modifieur adverbial', 'discourse': 'élément de discours',
604
- 'aux': 'auxiliaire', 'cop': 'copule', 'mark': 'marqueur', 'nmod': 'modifieur nominal',
605
  'appos': 'apposition', 'nummod': 'modifieur numéral', 'acl': 'clause relative', 'amod': 'modifieur adjectival', 'det': 'déterminant',
606
  'clf': 'classificateur', 'case': 'marqueur de cas', 'conj': 'conjonction', 'cc': 'coordination', 'fixed': 'expression figée',
607
- 'flat': 'construction plate', 'compound': 'composé', 'list': 'liste', 'parataxis': 'parataxe', 'orphan': 'orphelin', 'goeswith': 'va avec',
608
- 'reparandum': 'réparation', 'punct': 'ponctuation'
609
  }
610
  }
611
  morph_df[t['dependency']] = morph_df[t['dependency']].map(lambda x: dep_translations[lang_code].get(x, x))
@@ -623,17 +623,18 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
623
  'Fut': 'Futuro', 'Perf': 'Perfecto', 'Imp': 'Imperfecto'
624
  },
625
  'en': {
626
- 'Gender': 'Gender', 'Number': 'Number', 'Case': 'Case', 'Definite': 'Definite', 'PronType': 'Pronoun Type',
627
- 'Person': 'Person', 'Mood': 'Mood', 'Tense': 'Tense', 'VerbForm': 'Verb Form', 'Voice': 'Voice', 'Fem': 'Feminine',
628
- 'Masc': 'Masculine', 'Sing': 'Singular', 'Plur': 'Plural', 'Ind': 'Indicative', 'Sub': 'Subjunctive', 'Imp': 'Imperative',
629
- 'Inf': 'Infinitive', 'Part': 'Participle', 'Ger': 'Gerund', 'Pres': 'Present', 'Past': 'Past', 'Fut': 'Future', 'Perf': 'Perfect',
630
- 'Imp': 'Imperfect'
631
- },
632
  'fr': {
633
- 'Gender': 'Genre', 'Number': 'Nombre', 'Case': 'Cas', 'Definite': 'Défini', 'PronType': 'Type de Pronom', 'Person': 'Personne',
634
- 'Mood': 'Mode', 'Tense': 'Temps', 'VerbForm': 'Forme Verbale', 'Voice': 'Voix', 'Fem': 'Féminin', 'Masc': 'Masculin', 'Sing': 'Singulier',
635
- 'Plur': 'Pluriel', 'Ind': 'Indicatif', 'Sub': 'Subjonctif', 'Imp': 'Impératif', 'Inf': 'Infinitif', 'Part': 'Participe', 'Ger': 'Gérondif',
636
- 'Pres': 'Présent', 'Past': 'Passé', 'Fut': 'Futur', 'Perf': 'Parfait', 'Imp': 'Imparfait'
 
637
  }
638
  }
639
  for key, value in morph_translations[lang_code].items():
@@ -641,14 +642,14 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
641
  return morph_string
642
 
643
  morph_df[t['morphology']] = morph_df[t['morphology']].apply(lambda x: translate_morph(x, lang_code))
644
-
645
- # Seleccionar y ordenar las columnas a mostrar
646
- columns_to_display = [t['word'], t['lemma'], t['grammatical_category'], t['dependency'], t['morphology']]
647
- columns_to_display = [col for col in columns_to_display if col in morph_df.columns]
648
-
649
- # Mostrar el DataFrame
650
- st.dataframe(morph_df[columns_to_display])
651
-
652
  # Mostrar diagramas de arco (código existente)
653
  with st.expander(t['arc_diagram'], expanded=True):
654
  sentences = list(doc.sents)
 
532
  st.markdown(sentence_str)
533
 
534
  # Mostrar análisis de categorías gramaticales # Mostrar análisis morfológico
535
+ # Mostrar análisis de categorías gramaticales # Mostrar análisis morfológico
536
+ col1, col2 = st.columns(2)
537
 
538
  with col1:
 
539
  with st.expander(t['pos_analysis'], expanded=True):
540
  pos_df = pd.DataFrame(advanced_analysis['pos_analysis'])
541
 
 
586
  'flat': 'plano', 'compound': 'compuesto', 'list': 'lista', 'parataxis': 'parataxis',
587
  'orphan': 'huérfano', 'goeswith': 'va con', 'reparandum': 'reparación', 'punct': 'puntuación'
588
  },
 
589
  'en': {
590
+ 'ROOT': 'ROOT', 'nsubj': 'nominal subject', 'obj': 'object',
591
+ 'iobj': 'indirect object', 'csubj': 'clausal subject', 'ccomp': 'clausal complement', 'xcomp': 'open clausal complement',
592
+ 'obl': 'oblique', 'vocative': 'vocative', 'expl': 'expletive', 'dislocated': 'dislocated', 'advcl': 'adverbial clause modifier',
593
+ 'advmod': 'adverbial modifier', 'discourse': 'discourse element', 'aux': 'auxiliary', 'cop': 'copula', 'mark': 'marker',
594
+ 'nmod': 'nominal modifier', 'appos': 'appositional modifier', 'nummod': 'numeric modifier', 'acl': 'clausal modifier of noun',
595
+ 'amod': 'adjectival modifier', 'det': 'determiner', 'clf': 'classifier', 'case': 'case marking',
596
+ 'conj': 'conjunct', 'cc': 'coordinating conjunction', 'fixed': 'fixed multiword expression',
597
+ 'flat': 'flat multiword expression', 'compound': 'compound', 'list': 'list', 'parataxis': 'parataxis', 'orphan': 'orphan',
598
+ 'goeswith': 'goes with', 'reparandum': 'reparandum', 'punct': 'punctuation
599
  },
 
600
  'fr': {
601
+ 'ROOT': 'RACINE', 'nsubj': 'sujet nominal', 'obj': 'objet', 'iobj': 'objet indirect',
602
+ 'csubj': 'sujet phrastique', 'ccomp': 'complément phrastique', 'xcomp': 'complément phrastique ouvert', 'obl': 'oblique',
603
+ 'vocative': 'vocatif', 'expl': 'explétif', 'dislocated': 'disloqué', 'advcl': 'clause adverbiale', 'advmod': 'modifieur adverbial',
604
+ 'discourse': 'élément de discours', 'aux': 'auxiliaire', 'cop': 'copule', 'mark': 'marqueur', 'nmod': 'modifieur nominal',
605
  'appos': 'apposition', 'nummod': 'modifieur numéral', 'acl': 'clause relative', 'amod': 'modifieur adjectival', 'det': 'déterminant',
606
  'clf': 'classificateur', 'case': 'marqueur de cas', 'conj': 'conjonction', 'cc': 'coordination', 'fixed': 'expression figée',
607
+ 'flat': 'construction plate', 'compound': 'composé', 'list': 'liste', 'parataxis': 'parataxe', 'orphan': 'orphelin',
608
+ 'goeswith': 'va avec', 'reparandum': 'réparation', 'punct': 'ponctuation'
609
  }
610
  }
611
  morph_df[t['dependency']] = morph_df[t['dependency']].map(lambda x: dep_translations[lang_code].get(x, x))
 
623
  'Fut': 'Futuro', 'Perf': 'Perfecto', 'Imp': 'Imperfecto'
624
  },
625
  'en': {
626
+ 'Gender': 'Gender', 'Number': 'Number', 'Case': 'Case', 'Definite': 'Definite', 'PronType': 'Pronoun Type', 'Person': 'Person',
627
+ 'Mood': 'Mood', 'Tense': 'Tense', 'VerbForm': 'Verb Form', 'Voice': 'Voice',
628
+ 'Fem': 'Feminine', 'Masc': 'Masculine', 'Sing': 'Singular', 'Plur': 'Plural', 'Ind': 'Indicative',
629
+ 'Sub': 'Subjunctive', 'Imp': 'Imperative', 'Inf': 'Infinitive', 'Part': 'Participle',
630
+ 'Ger': 'Gerund', 'Pres': 'Present', 'Past': 'Past', 'Fut': 'Future', 'Perf': 'Perfect', 'Imp': 'Imperfect'
631
+ },
632
  'fr': {
633
+ 'Gender': 'Genre', 'Number': 'Nombre', 'Case': 'Cas', 'Definite': 'Défini', 'PronType': 'Type de Pronom',
634
+ 'Person': 'Personne', 'Mood': 'Mode', 'Tense': 'Temps', 'VerbForm': 'Forme Verbale', 'Voice': 'Voix',
635
+ 'Fem': 'Féminin', 'Masc': 'Masculin', 'Sing': 'Singulier', 'Plur': 'Pluriel', 'Ind': 'Indicatif',
636
+ 'Sub': 'Subjonctif', 'Imp': 'Impératif', 'Inf': 'Infinitif', 'Part': 'Participe',
637
+ 'Ger': 'Gérondif', 'Pres': 'Présent', 'Past': 'Passé', 'Fut': 'Futur', 'Perf': 'Parfait', 'Imp': 'Imparfait'
638
  }
639
  }
640
  for key, value in morph_translations[lang_code].items():
 
642
  return morph_string
643
 
644
  morph_df[t['morphology']] = morph_df[t['morphology']].apply(lambda x: translate_morph(x, lang_code))
645
+
646
+ # Seleccionar y ordenar las columnas a mostrar
647
+ columns_to_display = [t['word'], t['lemma'], t['grammatical_category'], t['dependency'], t['morphology']]
648
+ columns_to_display = [col for col in columns_to_display if col in morph_df.columns]
649
+
650
+ # Mostrar el DataFrame
651
+ st.dataframe(morph_df[columns_to_display])
652
+
653
  # Mostrar diagramas de arco (código existente)
654
  with st.expander(t['arc_diagram'], expanded=True):
655
  sentences = list(doc.sents)