C# Class SIL.FieldWorks.FDO.DomainServices.BtConverter

This class handles converting the CmTranslation-style back translation to the interlinear.
Mostrar archivo Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
ConvertCmTransToInterlin ( IStTxtPara para, int wsBt ) : void

Convert the CmTranslation version of the translation to the interlinear version.

Private Methods

Method Description
AppendLeftoverBtToLastSeg ( SegGroup group, int iParaSeg, ITsString tssFt ) : ITsString

If this paragraph segment is the last one for its group, but there are left-over BT segments, append them to this.

AppendWithOptionalSpace ( ITsStrBldr bldr, ITsString tssApp ) : void

Append tssApp to the builder. If both are non-empty and there is no white space at the end of bldr or the start of tssApp, also add a space.

BtConverter ( IStTxtPara para, int wsBt ) : System.Collections

Make one for converting the specified paragraph.

BuildLabelSegmentSet ( ) : void
ConvertCmTransToInterlin ( ) : void
ConvertedBtLabel ( ISegment seg ) : ITsString

Given a segment which points into your paragraph, return the string that should correspond to it in the BT.

DiscardMatchingSegsAtEnd ( SegGroup group ) : void
GetMainParaSegments ( ) : void
GetOriginalBtSegments ( ) : void
GetSegGroup ( int iStartTrans ) : List

Find a group of BT segments starting at the specified index and continuing up to, but not including, the first label segment (e.g., a chapter or verse number) that corresponds to something in the main paragraph. This can return an empty list if segment iStartTrans itself is a label segment. Label segments are not included, though ones that don't match anything in the paragraph may be skipped over.

IndexOfMatchingVerseSegInBt ( ITsString target, int iSegMin ) : int

Given a target verse label, see if there is a matching verse label in the BT. If so, return its index; otherwise, return -1.

InsertOrphanBtFromPreviousGroup ( int igroup, int iParaSeg, ITsString tssFt ) : ITsString

If this is the first segment in the group and NOT the first group, check for the possibility that there was no segment to attach the previous group's BTs to. I think this can only happen for the first group. Put the orphan BT at the start of this segment so it isn't lost.

IsWhite ( char c ) : bool
MakeGroup ( int iStartSegPara, int iStartSegBt, int &startOfNextBtSeg ) : int

We have determined that corresponding groups start at iStartSegPara in m_paraSegs/m_segments and iStartSegBt in m_BtSegs. Make a SegGroup out of the corresponding segments and return the index of the indexes of the starts of the next group (in each case one more than the index of the matching verse segment which ended the group in the paragraph sequence). One or both indexes might be greater than the length of the corresponding array, indicating that the group extends to the end. One or both parts of the group might be empty.

MakeGroups ( ) : void
MakeSegmentBtsForGroup ( int igroup ) : void

Make the necessary Free Translation annotation comments for the specified group of roughly matching segments. In general, we transfer corresponding material from the BT segment to the FT annotation of the main paragraph segment, with any left-over paragraph segments blank, and any left-over BT segments added to the end of the last FT segment. As a special case, if some FTs at the end of the list already have the exact text of corresponding BT ones (counting from the end of the lists), we assume that those pairs correspond, even if not in corresponding positions counting from the start, and don't change them. This helps preserve alignment when something may merge or split a segment in the base text after much of it is annotated.

MatchesSomeParaLabel ( ITsString label ) : bool

Answer true if the specified string is equal to some label segment of the paragraph

StringsEndWithSameWord ( ITsString firstTss, ITsString secondTss ) : bool

Determines whether the two strings end with the same word (i.e., same text and same style). Any white-space-only runs are ignored. The fundamental purpose for this method is to find a segment in the BT marked with the same chapter and/or verse number as the vernacular. The entire label string won't necessarily match because: a) whitespace differences, b) writing system differences, and c) verse numbers combined in a single label segment because there is no verse text (usually in the BT).

Method Details

ConvertCmTransToInterlin() public static method

Convert the CmTranslation version of the translation to the interlinear version.
public static ConvertCmTransToInterlin ( IStTxtPara para, int wsBt ) : void
para IStTxtPara The paragraph.
wsBt int The writing system for which to do the conversion.
return void