예제 #1
0
	if not path.endswith('.csv'):
		continue
	print('Reading %s' % path)
	if dm is None:
		dm = io.readtxt('data-ratings/%s' % path)
	else:
		dm <<= io.readtxt('data-ratings/%s' % path)

# This word was misspelled
dm = dm.word != 'térébrant'
# There are 30 participants who provided 2 ratings for 122 words
assert(len(dm) == 30*2*102)

rm = DataMatrix(length=101)
rm.word = ''
rm._type = ''
rm.rating_brightness = FloatColumn
rm.rating_valence = FloatColumn
rm.rating_intensity = FloatColumn
for row, word in zip(rm, dm.word.unique):
	dm_ = dm.word == word
	dme = dm_.rating_type == 'emotion'
	dmb = dm_.rating_type == 'brightness'
	# Pénombre was accidentally rated twice.
	assert(len(dmb)==30 or word == 'pénombre')
	assert(len(dme)==30 or word == 'pénombre')
	row.word = word
	row._type = dme.type[0]
	row.rating_brightness = dmb.rating.mean
	row.rating_valence = dme.rating.mean
	# The intensity is just the deviation from the middle score (2). In the