Replacing "\n" in an Excel file with a tag - Trados 2019

I have an Excel file where soft returns are coded as text (\n). I want to convert them to tags to get them out of my way. They often appear after segment-ending punctuation (period, exclamation point, question mark) without a space between the two, resulting in segments that can contain multiple sentences.

Source text in Excel and resulting segment in the converted file: Blah blah blah.\nText text text.

I would like:

Segment 1: Blah blah blah.

Segment 2: [tag]Text text text.

or

Segment 1: Blah blah blah.[tag]

Segmeng2: Text text text.

Working on a primitive level, I have prepped the Excel files by adding a space (search for ".\n" replace with ". \n" (etc. for ? and !) to get the segmentation right, but I really would like tags instead of \n -- they're distracting and make spell checking laborious (every "nText" has to be dealt with).

It would be wonderful to replace them with a tag and get the segmentation to work the way I want it to. The solution seems to lie in defining a tag in Embedded Content in the Excel file type and possibly also a segmentation rule. "\\n" doesn't work for me, but my knowledge of regex is pretty limited so any number of things could be wrong or missing.

Does anyone know how to go about configuring this?

Thanks in advance!

emoji
  • Use the embedded content feature in the Excel file type BEFORE adding the file into your project. You need to adapt the file type in your project template used.

    The regex needed to tag \n is \\n (double backslash n)

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

    emoji
  • Just to elaborate on that... don't forget (if it's appropriate for your file) to set the advanced segmentation for the rule to exclude and this should have your file a lot cleaner so you don't have to handle the tags at all:

    Trados Studio options menu with 'Embedded content' selected, showing settings for enabling content processing and defining tag rules with a focus on the 'Advanced...' button for segmentation settings.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 6:38 AM (GMT 0) on 29 Feb 2024]
  • Thank you, Jerzy. I've tried \\n a number of times and re-imported the Excel file into my project to no avail. The resulting file still has \n in place of a tag. I'll try it again just to make sure.

    emoji
  • Thank you! The Advanced Settings dialogue box is not very easy to figure out.

    emoji
  • Make sure you add this tag within the project template used and in the correct Excel file type. Doing so in File -> Options will most probably not work.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

    emoji
  • Thanks, I will try it again later today.

    One result I have observed is that by turning on Enable Embedded Content Processing, I do see conversion to tags of other coding when I reprocess the source file. So the default Regular Expression Start Tag <\?[\p{Ll}\p{Lu}]\w*[^<>]*> is being applied.

    The configuration I have currently:

    Default Placeholder, Regular Expression Start Tag <\?[\p{Ll}\p{Lu}]\w*[^<>]*> with Include With Text selected in Advanced Settings for Segmentation Hint.

    My unsuccessful Placeholder, Regular Expression Start Tag \\n with Exclude selected in Advanced Settings for Segmentation Hint

    emoji
  • Perhaps a small example in a file, just a couple of segments, to illustrate what you have.  Could be there is something slightly different in the file compared to what you have shared when asking for help?

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
  • Here's some screenshots:

    Screenshot of Trados Studio showing text with code remaining as text and the number 94 converted to a tag.

    You can see how the \n code has remained text while [94] is a <word> converted to a tag. The segmentation was achieved by Search for ".\n" replace with ". \n"

    Screenshot of Trados Studio Tag Definition Rules with two configured rules for start and end tag expressions.

    These are the two Tag Definition Rules configured.

    Screenshot of Trados Studio Advanced Settings for an Embedded Content Rule with Segmentation Hint set to Exclude.

    aHere are the Advanced Settings with the Segmentation Hint set to Exclude.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 6:38 AM (GMT 0) on 29 Feb 2024]
  • First: please make sure you are adapting the correct file type (what you do now is for xlsx). Should your file be a xls, this will not work. Then make sure you are adapting the file type in proper project template. And in the end select "Extract in all paragraphs" in the screenshot Paul shows.

    It also seems you have an older version of Studio, where the segmentation hint "Exclude" might not work.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

    emoji
  • Thank you.  It would have been more helpful to show the excel and not what it looks like in Studio, or even better provide an Excel so we don't have to type them in and possibly do something different.

    It also seems you have an older version of Studio, where the segmentation hint "Exclude" might not work.

    It does work... I created a short video using 2019 to check it.  Perhaps this will help:

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
1 2 3 4