Difference between revisions of "Replacing numbers Wordfast Classic"

From Wordfast Wiki
Jump to: navigation, search
(Created page with "A segmentation problem had produced segments where match values were often over 100. So the documents had such match values as <span style="color:#C71585"> <sup><}833{></sup>...")
 
 
Line 1: Line 1:
A segmentation problem had produced segments where match values were often over 100. So the documents had such match values as <span style="color:#C71585"> <sup><}833{></sup> </span> or <span style="color:#C71585"> <sup><}944{></sup> </span> etc. It appeared that the last figure of the match value had been duplicated (these two segments should have been <span style="color:#C71585"> <sup><}83{></sup> </span>.and <span style="color:#C71585"> <sup><}94{></sup> </span>). How could this be fixed in many documents, in one pass, making sure other figures are not modified by the procedure?
+
A segmentation problem had produced segments where match values were often over 100. So the documents had such match values as <}833{> or <}944{> etc. It appeared that the last figure of the match value had been duplicated (these two segments should have been <}83{>.and <}94{>). How could this be fixed in many documents, in one pass, making sure other figures are not modified by the procedure?
  
 
The answer is:
 
The answer is:
  
{|style="font-size: 9pt"
+
{|
 
|-
 
|-
 
|Find what ||(\<\})([1-9])(?)(?)(\{\>)
 
|Find what ||(\<\})([1-9])(?)(?)(\{\>)
Line 20: Line 20:
 
Look for chunks of text made of the following 5 contiguous expressions:
 
Look for chunks of text made of the following 5 contiguous expressions:
  
#<span style="font-size: 9pt"> ''<}'' followed by </span>
+
#''<}'' followed by
#<span style="font-size: 9pt">''Any number between 1 and 9'' followed by</span>
+
#''Any number between 1 and 9'' followed by
#<span style="font-size: 9pt">''any character'' followed by</span>
+
#''any character'' followed by
#<span style="font-size: 9pt">''any character'' followed by</span>
+
#''any character'' followed by
#<span style="font-size: 9pt">''{\>)''</span>
+
#''{\>)''
  
 
If such a chunk of text is found, replace the entire chunk with expressions 1, 2, 3, 5.
 
If such a chunk of text is found, replace the entire chunk with expressions 1, 2, 3, 5.

Latest revision as of 08:10, 6 November 2017

A segmentation problem had produced segments where match values were often over 100. So the documents had such match values as <}833{> or <}944{> etc. It appeared that the last figure of the match value had been duplicated (these two segments should have been <}83{>.and <}94{>). How could this be fixed in many documents, in one pass, making sure other figures are not modified by the procedure?

The answer is:

Find what (\<\})([1-9])(?)(?)(\{\>)
Replace with \1\2\3\5
Use Wildcards

Explanation: When the "Match wildcards" checkbox is checked, "expressions" are anything contained within parentheses. The "Replace with" numbers actually refers to expressions located in the "Find what" argument.

The ([1-9]) expression in the "Find what" argument, for example, refers to any number in the range 1 - 9. In the "Replace with" argument, it is referred to as \1, meaning, "expression 2".

So the FR action can be read as:

Look for chunks of text made of the following 5 contiguous expressions:

  1. <} followed by
  2. Any number between 1 and 9 followed by
  3. any character followed by
  4. any character followed by
  5. {\>)

If such a chunk of text is found, replace the entire chunk with expressions 1, 2, 3, 5.

As a result, the redundant number (expression 4) is deleted from match values, with no risk of upsetting the rest of the document. An added safety measure could be to set the style for the Search parameter to "tw4winMark".

 Back to Wordfast Classic User Manual