<s> from __future__ import print_function <EOL> import codecs <EOL> class PersicaReader ( ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , csv_file ) : <EOL> self . _csv_file = csv_file <EOL> def docs ( self ) : <EOL> lines = [ ] <EOL> for line in codecs . open ( self . _csv_file , encoding = '<STR_LIT>' ) : <EOL> line = line . strip ( ) <EOL> if line : <EOL> if line . endswith ( '<STR_LIT:U+002C>' ) : <EOL> lines . append ( line [ : - <NUM_LIT:1> ] ) <EOL> else : <EOL> lines . append ( line ) <EOL> yield { <EOL> '<STR_LIT:id>' : int ( lines [ <NUM_LIT:0> ] ) , <EOL> '<STR_LIT:title>' : lines [ <NUM_LIT:1> ] , <EOL> '<STR_LIT:text>' : lines [ <NUM_LIT:2> ] , <EOL> '<STR_LIT:date>' : lines [ <NUM_LIT:3> ] , <EOL> '<STR_LIT:time>' : lines [ <NUM_LIT:4> ] , <EOL> '<STR_LIT>' : lines [ <NUM_LIT:5> ] , <EOL> '<STR_LIT>' : lines [ <NUM_LIT:6> ] , <EOL> } <EOL> lines = [ ] <EOL> def texts ( self ) : <EOL> for doc in self . docs ( ) : <EOL> yield doc [ '<STR_LIT:text>' ] </s>
