Me di cuenta esta mañana de que es posible generar etiquetas usando cadenas literales. Sin embargo, es un poco un truco, porque depende de saber que Apertium coloca las etiquetas entre <> y me parece que el usuario de FlexTrans realmente no debería depender de tales detalles.
Sin embargo, esto significa que, habiendo extraído información básica del flujo de entrada (como la clase del sustantivo) en una variable de cadena literal (p. ej., var v_noun_class := string ‘3’), se puede hacer algo como:
let var v_gloss = “<”
append var v_gloss “NPx”
append var v_gloss “_”
append var v_gloss var v_noun_class
append var v_gloss “>”
… y luego se imprime var v_gloss y el resultado se sintetizará correctamente (como si se hubiera impreso la etiqueta literal NPx_3)
En mi caso, esto significa que también puedo generar una etiqueta de sufijo en una variable separada, cambiando simplemente NPx por NSx, lo cual es mucho más fácil (y más legible) que gestionar una gran estructura choose when … when … when … para cada etiqueta de afijo de salida que incluye información sobre la clase del sustantivo y algo más.
Así que, por un lado, parece un truco feo, y por otro, permite una generación más elegante y legible de etiquetas de afijos complicadas. ¿Qué opinan sobre este enfoque?
Saludos, bruce
I realised this morning that it is possible to generate tags using literal strings. It is, however, a bit of a hack, because it relies on knowing that Apertium puts tags in <> and it feels to me that the FlexTrans user really shouldn’t be relying on such details.
However, it means that, having extracted basic information from the input stream (like noun class) into a literal string variable (e.g., var v_noun_class := string ‘3’), one can do something like:
let var v_gloss = “<”
append var v_gloss “NPx”
append var v_gloss “_”
append var v_gloss var v_noun_class
append var v_gloss “>”
… and then output var v_gloss and the result will synthesize correctly (just as if I had output the literal tag NPx_3)
In my case, it means I can also generate a suffix tag in a separate variable, just changing NPx to NSx – which is a lot easier (and more readable) than managing a big choose when … when … when … structure for each output affix tag that includes noun class information and something more.
So on the one hand, it seems to be an ugly hack, and on the other, it allows more elegant and readable generation of complicated affix tags. What are your thoughts on this approach?
Cheers, bruce
Traducción automática desde English