<s> class HighLighter ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , pre_tags = None , post_tags = None , fields = None , fragment_size = None , number_of_fragments = None , <EOL> fragment_offset = None , encoder = None ) : <EOL> self . pre_tags = pre_tags <EOL> self . post_tags = post_tags <EOL> self . fields = fields or { } <EOL> self . fragment_size = fragment_size <EOL> self . number_of_fragments = number_of_fragments <EOL> self . fragment_offset = fragment_offset <EOL> self . encoder = encoder <EOL> def add_field ( self , name , fragment_size = <NUM_LIT> , number_of_fragments = <NUM_LIT:3> , fragment_offset = None , order = "<STR_LIT>" , type = None ) : <EOL> """<STR_LIT>""" <EOL> data = { } <EOL> if fragment_size : <EOL> data [ '<STR_LIT>' ] = fragment_size <EOL> if number_of_fragments is not None : <EOL> data [ '<STR_LIT>' ] = number_of_fragments <EOL> if fragment_offset is not None : <EOL> data [ '<STR_LIT>' ] = fragment_offset <EOL> if type is not None : <EOL> data [ '<STR_LIT:type>' ] = type <EOL> data [ '<STR_LIT>' ] = order <EOL> self . fields [ name ] = data <EOL> def serialize ( self ) : <EOL> res = { } <EOL> if self . pre_tags : <EOL> res [ "<STR_LIT>" ] = self . pre_tags <EOL> if self . post_tags : <EOL> res [ "<STR_LIT>" ] = self . post_tags <EOL> if self . fragment_size : <EOL> res [ "<STR_LIT>" ] = self . fragment_size <EOL> if self . number_of_fragments : <EOL> res [ "<STR_LIT>" ] = self . number_of_fragments <EOL> if self . fragment_offset : <EOL> res [ "<STR_LIT>" ] = self . fragment_offset <EOL> if self . encoder : <EOL> res [ "<STR_LIT>" ] = self . encoder <EOL> if self . fields : <EOL> res [ "<STR_LIT>" ] = self . fields <EOL> else : <EOL> res [ "<STR_LIT>" ] = { "<STR_LIT>" : { } } <EOL> return res </s>
