Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tag replacement feature implementation is splited into 2 functions: 
GenerateReplacingTag -     input  - tagType, attributeList
                        output - tagInfo
    this function would generate tagInfo data structure that saves original data(tagType, attributes(i\rid and x\id only) and would generate new data that suits context\segment 
PrintTag - input  - tagInfo
         - output - text representation of tag with attributes depending on context 
    this function would print tag with attributes(if they exist(bigger than 0). If it's fuzzy call, would replace for source and target segments tags with matching tags from fuzzy search request. 
        If matching tag not found - would generate new tag in xliff format with id or rid attributes that rising starting from biggest id and rid values +1 that was present in requested segment 
        for fuzzy search request segment this function would pring tag with generated data - that is never used in production, but can be used to find out how mechanism normalized input fuzzy search request segment
            (we base tag matching on this normalization.)

...

for source\target segments this replacement is done at import process, for fuzzy search request we do tag replacement, then look for matches between source 
    source and request segments(this happens in PringTag function), then replace tag from source with original tag that was in request
then we do the same with target segment - we try to find matches of target tags with generated tags in request, and then replace tags in target 
    with original tags from fuzzy search request 
    
for example, we have this segments in import process 
    'source':"Select the <hi>net<ph/>work <g>BLK360</g> tag </hi>",
    'target':"Select the <hi>net<ph/>work <g>BLK360</g> tag </hi>",
after tag replacement we would have this saved in tm:
    'source' :'Select the <bpt x="1" i="1"/>net<ph x="2"/>work <bpt x="3" i="2"/>BLK360<ept i="2"/> tag <ept i="1"/>',
    'target' :'Select the <bpt x="1" i="1"/>net<ph x="2"/>work <bpt x="3" i="2"/>BLK360<ept i="2"/> tag <ept i="1"/>',

then if we would have fuzzy request call with segment:    
    "Select the <g>net<x/>work< >work <g>BLK360</g> tag </g>"
after normalization we would get this:
    "Select the <bpt x="1" i="1"/>net<ph x="2"/>work <bpt x="3" i="2"/>BLK360<ept i="2"/> tag <ept i="1"/>"

and then we would try to find matching tags in source and normalized request segments and in case of match-replace tag in src with original from fuzzy search request
and then do the same with target and request 
in responce response we should have:
'source' :'Select the <g>net<x/>work <g>BLK360</q> tag </g>',
 'target' :'Select the <g>net<x/>work <g>BLK360</q> tag </g>',

...

TagReplacer{
      // lists of tagInfo 
      SOURCE_TAGS
      TARGET_TAGS
      REQUEST_TAGS
      
      activeSegment  //could be one of following SOURCE_SEGMENT(default value), TARGET_SEGMENT, REQUEST_SEGMENT. Say Tells us how we should handle tag replacement
      
      iHighestI   = 0;               // increments with each opening pair tags
      iHighestId  = 0;               // increments with each tag
      
      fFuzzyRequest = false;         // flag, that tracks if we are dealing with import or fuzzy request. Say Tells us how we should handle tag replacement

...