C# Class SILUBS.ScriptureChecks.ProcessPunctationTokens

State machine to process sequences of punctuation tokens. We have one of these objects for note text, one for body text.
Mostrar archivo Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
AdvancedFinalize void
BasicFinalize void
IntermediateFinalize void
ProcessDigit void
ProcessPunctuation void
PunctuationSequencePatternPrefix string
PunctuationSequencePatternSuffix string

Public Methods

Method Description
FinalizeResult ( string desiredKey, List result, bool addWhitespace ) : void

ProcessPunctationTokens ( CharacterCategorizer categorizer, QuotationMarkCategorizer quotationCategorizer, CheckingLevel level ) : System

Initializes a new instance of the ProcessPunctationTokens class.

ProcessToken ( ITextToken tok, string desiredKey, List result ) : void

Extract the punctuation sequences from this token

ProcessWhitespaceOrParagraph ( bool fIsParaStart ) : void

Add whitespace to the list unless the last item in the list is already whitespace

Private Methods

Method Description
AdvancedFinalize ( PunctuationToken pTok, string desiredKey, List result ) : void

Treat each punctuation and whitespace sequence as a single string. It is called advanced since many more inventory items for the user to look at, and only advanced users (we hope) will look at these results.

BasicFinalize ( string desiredKey, List result ) : void

Basic finalize is complicated because it generates a pattern for every punctuation mark. An exception is if multiple consecutive periods occur, then a string of periods will be in one pattern.

IntermediateFinalize ( string desiredKey, List result ) : void

Treat each punctuation sequence as a single string, breaking the pattern at each whitespace (Except for whitespace between pairs of quotes that are both in the same direction (both opening or closing quotes).

ProcessDigit ( ITextToken tok, int i ) : void

Add a number to the list

ProcessPunctuation ( ITextToken tok, int i ) : void

Add punctuation to list

PunctuationSequencePatternPrefix ( int index ) : string

Look at previous non-punctuation tokens, the first token that is found determines the prefix for this pattern for example, if it finds whitespace token, it returns a prefix of _

PunctuationSequencePatternSuffix ( int index ) : string

Look at following non-punctuation tokens, the first token that is found determines the suffix for this pattern for example, if it finds whitespace token, it returns a suffix of _

Method Details

FinalizeResult() public method

public FinalizeResult ( string desiredKey, List result, bool addWhitespace ) : void
desiredKey string
result List
addWhitespace bool
return void

ProcessPunctationTokens() public method

Initializes a new instance of the ProcessPunctationTokens class.
public ProcessPunctationTokens ( CharacterCategorizer categorizer, QuotationMarkCategorizer quotationCategorizer, CheckingLevel level ) : System
categorizer SILUBS.SharedScrUtils.CharacterCategorizer The categorizer.
quotationCategorizer QuotationMarkCategorizer The quotation categorizer.
level CheckingLevel Indicator to determine how much to combine contiguous /// punctuation sequences into patterns. Advanced = All contiguous punctuation and /// whitespace characters form a single pattern; Intermediate = Contiguous punctuation /// forms a single pattern (delimeted by whitespace); Basic = Each punctuation character /// stands alone. In all three modes, whitespace before and/or after a punctuation token /// indicates whether is is word-initial, word-medial, word-final, or isolated
return System

ProcessToken() public method

Extract the punctuation sequences from this token
public ProcessToken ( ITextToken tok, string desiredKey, List result ) : void
tok ITextToken
desiredKey string
result List
return void

ProcessWhitespaceOrParagraph() public method

Add whitespace to the list unless the last item in the list is already whitespace
public ProcessWhitespaceOrParagraph ( bool fIsParaStart ) : void
fIsParaStart bool True for the token to be a paragraph start, false otherwise. ///
return void