[liblouis-liblouisxml] Re: srcMapping, prevSrcMapping and inputPositions arrays

  • From: James Teh <jamie@xxxxxxxxxxxx>
  • To: "liblouis-liblouisxml@xxxxxxxxxxxxx" <liblouis-liblouisxml@xxxxxxxxxxxxx>
  • Date: Wed, 19 Sep 2012 22:41:33 +1000

Hi Bert,

Yes it is, but so is inputPositions, so it should be the same.

Jamie
On 19/09/2012, at 10:17 PM, Bert Frees <bertfrees@xxxxxxxxx> wrote:

> Hi Jamie,
>
> I'm not so sure what you suggest is possible. Isn't srcMapping a global 
> variable? I may be wrong it's been a while since I looked at the code.
>
> Bert
>
>
> On 09/19/2012 04:39 AM, James Teh wrote:
>> Hi all, particularly John, Timothy and Bert (copying Timothy in case he's no 
>> longer on the list),
>>
>> There have been a few iterations of the inputPositions handling code:
>> 1. We just had inputPositions, which breaks with multiple passes.
>> 2. Then, srcMapping was added, but it wasn't used in all places:
>> //www.freelists.org/post/liblouis-liblouisxml/House-cleaning-ie-pending-patches,5
>> //www.freelists.org/post/liblouis-liblouisxml/srcMapping-patch-for-forwards-and-backwards-translation
>> 3. Finally, prevSrcMapping was added:
>> //www.freelists.org/post/liblouis-liblouisxml/inputPos-fixes
>> When these patches were committed, I didn't understand enough to comment 
>> much, but as I look deeper, this question occurs to me:
>>
>> Why not just have two arrays: prevInputPositions and inputPositions? 
>> srcMapping only gets copied to inputPositions at the end of the translation 
>> anyway (and inputPositions isn't used elsewhere from what I can see), which 
>> means that it's unused until that point. So, before each pass, we copy 
>> inputPositions to prevInputPositions, just as we now copy srcMapping to 
>> prevSrcMapping. Both arrays map to positions in the original input, but 
>> prevInputPositions maps from positions in the output of the previous pass, 
>> whereas inputPositions maps from positions in the output of the *current* 
>> pass. The only difference is that we no longer have to do a copy at the end. 
>> I think this confusion only happened because srcMapping wasn't fully 
>> implemented in iteration 2, so Bert felt we needed a third array. Does this 
>> sound right or am I missing something here?
>>
>> I think I'm slowly getting to the bottom of why outputPositions is broken. 
>> Again, it is a matter of the wrong mapping being used.
>>
>> Jamie
>>
>
> For a description of the software, to download it and links to
> project pages go to http://www.abilitiessoft.com
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: