AIdeaText commited on
Commit
b8ad8e4
verified
1 Parent(s): ed336bd

Update modules/morphosyntax/morphosyntax_interface.py

Browse files
modules/morphosyntax/morphosyntax_interface.py CHANGED
@@ -257,6 +257,31 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
257
  logger.error(f"Error general en la interfaz: {str(e)}")
258
 
259
  ############################################################################
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
  def display_morphosyntax_results(result, lang_code, morpho_t):
262
  """
 
257
  logger.error(f"Error general en la interfaz: {str(e)}")
258
 
259
  ############################################################################
260
+ def display_arc_diagram(doc, analysis):
261
+ """Muestra un diagrama de arco sin t铆tulo"""
262
+ try:
263
+ for sent in doc.sents:
264
+ html = displacy.render(sent, style="dep", options={
265
+ "distance": 100,
266
+ "arrow_spacing": 20,
267
+ "word_spacing": 30
268
+ })
269
+
270
+ # Ajustar tama帽o y posici贸n
271
+ html = html.replace('height="375"', 'height="200"')
272
+ html = re.sub(r'<svg[^>]*>', lambda m: m.group(0).replace('height="450"', 'height="300"'), html)
273
+ html = re.sub(r'<g [^>]*transform="translate\((\d+),(\d+)\)"',
274
+ lambda m: f'<g transform="translate({m.group(1)},50)"', html)
275
+
276
+ # Envolver en contenedor con estilo
277
+ html = f'<div class="arc-diagram-container">{html}</div>'
278
+
279
+ st.write(html, unsafe_allow_html=True)
280
+
281
+ except Exception as e:
282
+ logger.error(f"Error en display_arc_diagram: {str(e)}")
283
+
284
+ ####################
285
 
286
  def display_morphosyntax_results(result, lang_code, morpho_t):
287
  """