def _str2records(filename, rel):
 recs = []
 contents = nltk.data.load((u'corpora/chat80/%s' % filename), format=u'text')
 for line in contents.splitlines():
  if line.startswith(rel):
   line = re.sub((rel + u'\\('), u'', line)
   line = re.sub(u'\\)\\.$', u'', line)
   record = line.split(u',')
   recs.append(record)
 return recs

def _str2records ( filename , rel ) : recs = [ ] contents = nltk . data . load ( ( u'corpora/chat80/%s' % filename ) , format = u'text' ) for line in contents . splitlines ( ) : if line . startswith ( rel ) : line = re . sub ( ( rel + u'\\(' ) , u'' , line ) line = re . sub ( u'\\)\\.$' , u'' , line ) record = line . split ( u',' ) recs . append ( record ) return recs
read a file into memory and convert each relation clause into a list .