code: def stats_positions(self,meter=None,all_parses=False):
  		parses = self.allParses(meter=meter) if all_parses else [[parse] for parse in self.bestParses(meter=meter)]
  		dx={}
  		for parselist in parses:
  			for parse in parselist:
  				if not parse: continue
  				slot_i=0
  				for pos in parse.positions:
  					for slot in pos.slots:
  						slot_i+=1
  						feat_dicts = [slot.feats, pos.constraintScores, pos.feats]
  						for feat_dict in feat_dicts:
  							for k,v in feat_dict.items():
  								dk = (slot_i,str(k))
  								if not dk in dx: dx[dk]=[]
  								dx[dk]+=[v]
  		def _writegen():
  			for ((slot_i,k),l) in sorted(dx.items()):
  				l2=[]
  				for x in l:
  					if type(x)==bool:
  						x=1 if x else 0
  					elif type(x)==type(None):
  						x=0
  					elif type(x) in [str,unicode]:
  						continue
  					else:
  						x=float(x)
  					if x>1: x=1
  					l2+=[x]
  				if not l2: continue
  				avg=sum(l2) / float(len(l2))
  				count=sum(l2)
  				chances=len(l2)
  				odx={'slot_num':slot_i, 'statistic':k, 'average':avg, 'count':count, 'chances':chances, 'text':self.name}
  				odx['header']=['slot_num', 'statistic','count','chances','average']
  				yield odx
  		name=self.name.replace('.txt','')
  		ofn=os.path.join(self.dir_results, 'stats','texts',name, name+'.positions.csv')
  		if not os.path.exists(os.path.split(ofn)[0]): os.makedirs(os.path.split(ofn)[0])
  		for dx in writegengen(ofn, _writegen):
  			yield dx
  		print '>> saved:',ofn