Skip to content

Exception using PlaceMarkersUsfmUpdateBlockHandler with Devanagari #492

Description

@pmachapman

Serval is generating an error when retrieving USFM for a back translation to Hindi with preserve paragraph markers enabled:

Exception thrown: 'SIL.Machine.Corpora.UsfmUpdateBlockHandlerException' in SIL.Machine.dll: 'No token "ं" found in text ""कब च तेरु परमेश्वर?" इन सवालों के मेरे दूसरे ताना मि पर मरदिन, हर बगत इन लगदु जन व मेरे सर पे ते कटदिन नह ं। " at or beyond index 106. Is the versification correctly specified?'

This issue is affecting one project on Scripture Forge, but I have supplied a workaround to the user (select "Move to end" or "Remove" for paragraph breaks). The workaround is probably not ideal given the draft is from the Psalms.

This unit test recreates the bug:

Note: The update rows and alignment are from the back translation, and I have substituted the BSB for the source project.

[Test]publicvoidUpdateBlock_AnusvaraTokenization(){// The anusvara ("ं") is the third to last character in the update rows stringstringsource="Like the crushing of my bones, my enemies taunt me, while they say to me all day long, “Where is your God?”";stringupdateRows="\"कब च तेरु परमेश्वर?\" इन सवालों के मेरे दूसरे ताना मि पर मरदिन, हर बगत इन लगदु जन व मेरे सर पे ते कटदिन नह ं। ";PlaceMarkersAlignmentInfoalignInfo=newPlaceMarkersAlignmentInfo(sourceTokens:[.. Tokenizer.Tokenize(source)],translationTokens:[.. Tokenizer.Tokenize(updateRows)],alignment:ToWordAlignmentMatrix("0-0 1-1 2-2 3-3 4-4 5-5 6-6 7-7 8-8 9-9 10-10 11-11 12-12 13-13 14-14 15-15 16-16 17-17 18-18 19-19 20-20 21-21 22-22 23-23 24-24 24-25 25-26 26-27 26-28 26-29 27-30"),paragraphBehavior:UpdateUsfmMarkerBehavior.Preserve,styleBehavior:UpdateUsfmMarkerBehavior.Strip);IReadOnlyList<UpdateUsfmRow>rows=[newUpdateUsfmRow(ScrRef("PSA 42:10"),updateRows,newDictionary<string,object>{{"alignment_info",alignInfo}}),];stringusfm=@"\id PSA\c 42\q1\v 10 Like the crushing of my bones, my enemies taunt me,\q2 while they say to me all day long, “Where is your God?”";stringtarget=UpdateUsfm(rows,usfm,paragraphBehavior:UpdateUsfmMarkerBehavior.Preserve,usfmUpdateBlockHandlers:[newPlaceMarkersUsfmUpdateBlockHandler()]);stringresult=@"\id PSA\c 42\q1\v 10 ""कब च तेरु परमेश्वर?"" इन सवालों के मेरे दूसरे\q2 ताना मि पर मरदिन, हर बगत इन लगदु जन व मेरे सर पे ते कटदिन नह ं ।";AssertUsfmEquals(target,result);}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    • Status
      🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions