code: def sentences(self):
          
          prevp = 0
          prevs = 0
          sentence = [];
          sentence_id = ""
          for word, id, pos, lemma in iter(self):
              try:
                  doc_id, ptype, p, s, w = re.findall('([\w\d-]+)\.(p|head)\.(\d+)\.s\.(\d+)\.w\.(\d+)',id)[0]
                  if ((p != prevp) or (s != prevs)) and sentence:
                      yield sentence_id, sentence
                      sentence = []
                      sentence_id = doc_id + '.' + ptype + '.' + str(p) + '.s.' + str(s)
                  prevp = p
              except IndexError:
                  doc_id, s, w = re.findall('([\w\d-]+)\.s\.(\d+)\.w\.(\d+)',id)[0]
                  if s != prevs and sentence:
                      yield sentence_id, sentence
                      sentence = []
                      sentence_id = doc_id + '.s.' + str(s)
              sentence.append( (word,id,pos,lemma) )
              prevs = s
          if sentence:
              yield sentence_id, sentence
docs: Iterate over all sentences (sentence_id, sentence) in the document, sentence is a list of 4-tuples (word,id,pos,lemma)