Spaces:
Running
Running
Update modules/morphosyntax/morphosyntax_interface.py
Browse files
modules/morphosyntax/morphosyntax_interface.py
CHANGED
|
@@ -15,117 +15,6 @@ import logging
|
|
| 15 |
logger = logging.getLogger(__name__)
|
| 16 |
|
| 17 |
def display_morphosyntax_analysis_interface(nlp_models, lang_code):
|
| 18 |
-
translations = {
|
| 19 |
-
'es': {
|
| 20 |
-
'title': "AIdeaText - Análisis morfológico y sintáctico",
|
| 21 |
-
'input_label': "Ingrese un texto para analizar (máximo 5,000 palabras",
|
| 22 |
-
'input_placeholder': "Esta funcionalidad le ayudará con dos competencias:\n"
|
| 23 |
-
"[1] \"Escribe diversos tipos de textos en su lengua materna\"\n"
|
| 24 |
-
"[2] \"Lee diversos tipos de textos escritos en su lengua materna\"\n\n"
|
| 25 |
-
"Ingrese su texto aquí para analizar...",
|
| 26 |
-
'analyze_button': "Analizar texto",
|
| 27 |
-
'repeated_words': "Palabras repetidas",
|
| 28 |
-
'legend': "Leyenda: Categorías gramaticales",
|
| 29 |
-
'arc_diagram': "Análisis sintáctico: Diagrama de arco",
|
| 30 |
-
'sentence': "Oración",
|
| 31 |
-
'success_message': "Análisis guardado correctamente.",
|
| 32 |
-
'error_message': "Hubo un problema al guardar el análisis. Por favor, inténtelo de nuevo.",
|
| 33 |
-
'warning_message': "Por favor, ingrese un texto para analizar.",
|
| 34 |
-
'initial_message': "Ingrese un texto y presione 'Analizar texto' para comenzar.",
|
| 35 |
-
'no_results': "No hay resultados disponibles. Por favor, realice un análisis primero.",
|
| 36 |
-
'pos_analysis': "Análisis de categorías gramaticales",
|
| 37 |
-
'morphological_analysis': "Análisis morfológico",
|
| 38 |
-
'sentence_structure': "Estructura de oraciones",
|
| 39 |
-
'word': "Palabra",
|
| 40 |
-
'count': "Cantidad",
|
| 41 |
-
'percentage': "Porcentaje",
|
| 42 |
-
'examples': "Ejemplos",
|
| 43 |
-
'lemma': "Lema",
|
| 44 |
-
'tag': "Etiqueta",
|
| 45 |
-
'dep': "Dependencia",
|
| 46 |
-
'morph': "Morfología",
|
| 47 |
-
'root': "Raíz",
|
| 48 |
-
'subjects': "Sujetos",
|
| 49 |
-
'objects': "Objetos",
|
| 50 |
-
'verbs': "Verbos",
|
| 51 |
-
'grammatical_category': "Categoría gramatical",
|
| 52 |
-
'dependency': "Dependencia",
|
| 53 |
-
'morphology': "Morfología"
|
| 54 |
-
},
|
| 55 |
-
'en': {
|
| 56 |
-
'title': "AIdeaText - Morphological and Syntactic Analysis",
|
| 57 |
-
'input_label': "Enter a text to analyze (max 5,000 words):",
|
| 58 |
-
'input_placeholder': "This functionality will help you with two competencies:\n"
|
| 59 |
-
"[1] \"Write various types of texts in your native language\"\n"
|
| 60 |
-
"[2] \"Read various types of written texts in your native language\"\n\n"
|
| 61 |
-
"Enter your text here to analyze...",
|
| 62 |
-
'analyze_button': "Analyze text",
|
| 63 |
-
'repeated_words': "Repeated words",
|
| 64 |
-
'legend': "Legend: Grammatical categories",
|
| 65 |
-
'arc_diagram': "Syntactic analysis: Arc diagram",
|
| 66 |
-
'sentence': "Sentence",
|
| 67 |
-
'success_message': "Analysis saved successfully.",
|
| 68 |
-
'error_message': "There was a problem saving the analysis. Please try again.",
|
| 69 |
-
'warning_message': "Please enter a text to analyze.",
|
| 70 |
-
'initial_message': "Enter a text and press 'Analyze text' to start.",
|
| 71 |
-
'no_results': "No results available. Please perform an analysis first.",
|
| 72 |
-
'pos_analysis': "Part of Speech Analysis",
|
| 73 |
-
'morphological_analysis': "Morphological Analysis",
|
| 74 |
-
'sentence_structure': "Sentence Structure",
|
| 75 |
-
'word': "Word",
|
| 76 |
-
'count': "Count",
|
| 77 |
-
'percentage': "Percentage",
|
| 78 |
-
'examples': "Examples",
|
| 79 |
-
'lemma': "Lemma",
|
| 80 |
-
'tag': "Tag",
|
| 81 |
-
'dep': "Dependency",
|
| 82 |
-
'morph': "Morphology",
|
| 83 |
-
'root': "Root",
|
| 84 |
-
'subjects': "Subjects",
|
| 85 |
-
'objects': "Objects",
|
| 86 |
-
'verbs': "Verbs",
|
| 87 |
-
'grammatical_category': "Grammatical category",
|
| 88 |
-
'dependency': "Dependency",
|
| 89 |
-
'morphology': "Morphology"
|
| 90 |
-
},
|
| 91 |
-
'fr': {
|
| 92 |
-
'title': "AIdeaText - Analyse morphologique et syntaxique",
|
| 93 |
-
'input_label': "Entrez un texte à analyser (max 5 000 mots) :",
|
| 94 |
-
'input_placeholder': "Cette fonctionnalité vous aidera avec deux compétences :\n"
|
| 95 |
-
"[1] \"Écrire divers types de textes dans votre langue maternelle\"\n"
|
| 96 |
-
"[2] \"Lire divers types de textes écrits dans votre langue maternelle\"\n\n"
|
| 97 |
-
"Entrez votre texte ici pour l'analyser...",
|
| 98 |
-
'analyze_button': "Analyser le texte",
|
| 99 |
-
'repeated_words': "Mots répétés",
|
| 100 |
-
'legend': "Légende : Catégories grammaticales",
|
| 101 |
-
'arc_diagram': "Analyse syntaxique : Diagramme en arc",
|
| 102 |
-
'sentence': "Phrase",
|
| 103 |
-
'success_message': "Analyse enregistrée avec succès.",
|
| 104 |
-
'error_message': "Un problème est survenu lors de l'enregistrement de l'analyse. Veuillez réessayer.",
|
| 105 |
-
'warning_message': "Veuillez entrer un texte à analyser.",
|
| 106 |
-
'initial_message': "Entrez un texte et appuyez sur 'Analyser le texte' pour commencer.",
|
| 107 |
-
'no_results': "Aucun résultat disponible. Veuillez d'abord effectuer une analyse.",
|
| 108 |
-
'pos_analysis': "Analyse des parties du discours",
|
| 109 |
-
'morphological_analysis': "Analyse morphologique",
|
| 110 |
-
'sentence_structure': "Structure des phrases",
|
| 111 |
-
'word': "Mot",
|
| 112 |
-
'count': "Nombre",
|
| 113 |
-
'percentage': "Pourcentage",
|
| 114 |
-
'examples': "Exemples",
|
| 115 |
-
'lemma': "Lemme",
|
| 116 |
-
'tag': "Étiquette",
|
| 117 |
-
'dep': "Dépendance",
|
| 118 |
-
'morph': "Morphologie",
|
| 119 |
-
'root': "Racine",
|
| 120 |
-
'subjects': "Sujets",
|
| 121 |
-
'objects': "Objets",
|
| 122 |
-
'verbs': "Verbes",
|
| 123 |
-
'grammatical_category': "Catégorie grammaticale",
|
| 124 |
-
'dependency': "Dépendance",
|
| 125 |
-
'morphology': "Morphologie"
|
| 126 |
-
}
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
t = translations[lang_code]
|
| 130 |
|
| 131 |
input_key = f"morphosyntax_input_{lang_code}"
|
|
|
|
| 15 |
logger = logging.getLogger(__name__)
|
| 16 |
|
| 17 |
def display_morphosyntax_analysis_interface(nlp_models, lang_code):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
t = translations[lang_code]
|
| 19 |
|
| 20 |
input_key = f"morphosyntax_input_{lang_code}"
|