Generating affixes from multiple tags

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 whenwhenwhen … 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

Yes, it’s a bit of a hack, but seems like a useful one that ultimately makes your rule more maintainable.

By the way, you can append multiple things to a variable (or anything else):

APPEND VAR v_gloss LIT_STR “<NPx_” VAR v_noun_class LIT_STR “>”

Well done!