Pesky spaces around tags after MT
Thread poster: Quentin N.
Quentin N.
Quentin N.
English to French
Nov 8, 2020

Hello all,

I am frequently working with a client on MT review projects. The problem is, whatever MT process they are using has a tendency of messing up the spaces around tags, and I often space an inordinate amount of time working specifically on correcting this.

MemoQ's QA feature generally picks up on those and allows me to autocorrect spacing, however only one instance at a time, which does not necessarily make the whole process much more time efficient.

... See more
Hello all,

I am frequently working with a client on MT review projects. The problem is, whatever MT process they are using has a tendency of messing up the spaces around tags, and I often space an inordinate amount of time working specifically on correcting this.

MemoQ's QA feature generally picks up on those and allows me to autocorrect spacing, however only one instance at a time, which does not necessarily make the whole process much more time efficient.

Would you be aware of a way to use Search and Replace, and possibly Regex, to automate the process and force spacing around tags in the target to be identical to that of the source?

Thank you in advance!

Quentin
Collapse


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 23:06
Member (2006)
English to Afrikaans
+ ...
@Quentin Nov 8, 2020

Quentin N. wrote:
MemoQ's QA feature generally picks up on those and allows me to autocorrect spacing, however only one instance at a time, which does not necessarily make the whole process much more time efficient.


How about exporting to bilingual review, fixing it (perhaps using a couple of macros that you record in Word), and then importing it again? One of the macros that I use add highlighting to all tags with spaces and punctuation marks, so that I can see in the source column which tags need spaces and which ones don't, in order to fix it in the target column. (You may need to remember to remove highlighting before importing it back into MemoQ.)


 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
There’s a macro for that Nov 9, 2020

Samuel Murray wrote:
(You may need to remember to remove highlighting before importing it back into MemoQ.)



Sub AutoClose()
‘ Each time you close a document


 
James Plastow
James Plastow  Identity Verified
United Kingdom
Local time: 22:06
Member (2020)
Japanese to English
regex Nov 12, 2020

How about

- this should match a tag (but I don't use MemoQ so possibly it is different).
\s - for a space
\w - for a letter
Then enclose the "tag" and "letter" in brackets so you can backreference them as Group 1 and Group 2 ($1 and $2)

So,

Find: ()\s(\w)
Replace: $1$2

for spaces after tags


Find: (\w)\s()
Replace: $1$2

for spaces before tags


edit
... See more
How about

- this should match a tag (but I don't use MemoQ so possibly it is different).
\s - for a space
\w - for a letter
Then enclose the "tag" and "letter" in brackets so you can backreference them as Group 1 and Group 2 ($1 and $2)

So,

Find: ()\s(\w)
Replace: $1$2

for spaces after tags


Find: (\w)\s()
Replace: $1$2

for spaces before tags


edit: I see the html formatting on comments doesn't let me write the characters for a regex match of a tag. It should be "less than arrow" ".+?" "greater than arrow"

[Edited at 2020-11-12 01:57 GMT]
Collapse


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 23:06
Member (2006)
English to Afrikaans
+ ...
@James Nov 12, 2020

James Plastow wrote:
Find: (<.+?>)\s(\w)
Replace: $1$2

Find: (\w)\s(<.+?>)
Replace: $1$2


1. Use &lt; and &gt;.

2. Yes, but you don't want *all* spaces next to tags to be removed. You only want spaces to be removed that should not be there. If a space is present in the source text, often a space should also be there in the translation.


 
Anthony Rudd
Anthony Rudd

Local time: 23:06
German to English
+ ...
\tag Nov 12, 2020

memoQ has a little-known proprietary metacharacter \tag that matches any tag. It can sometimes be very useful.

 
James Plastow
James Plastow  Identity Verified
United Kingdom
Local time: 22:06
Member (2020)
Japanese to English
Thank you Nov 12, 2020

Samuel Murray wrote:

James Plastow wrote:
Find: ()\s(\w)
Replace: $1$2

Find: (\w)\s()
Replace: $1$2


1. Use < and >.

2. Yes, but you don't want *all* spaces next to tags to be removed. You only want spaces to be removed that should not be there. If a space is present in the source text, often a space should also be there in the translation.



Thanks for the hint Samuel!
I guess if you want to keep some of the spaces you can go through manually with Find and Replace rather than using Replace All.


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Pesky spaces around tags after MT






Anycount & Translation Office 3000
Translation Office 3000

Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.

More info »
Trados Business Manager Lite
Create customer quotes and invoices from within Trados Studio

Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.

More info »