def _createPhoneticList(self): for row in self._labelFile: sample = Sample() sample.timestamp = row[0] sample.phonetic = Ipa.simplifySymbol(row[2]) record = self._samplingFile.search(float(row[0])); sample.zcr = float(record["ZCR"]) sample.variance = float(record["Spectrum Variance"]) sample.rms = float(record["RMS"]) sample.str = float(record["STE"]) self._phoneticList.append(sample)
def __setitem__(self,key,value): k = Ipa.simplifySymbol(key) self._data[k] = value
for f in files: filename , ext = os.path.splitext(f) if ext == ".wav": print "Reading %s dataset..." % filename dataset = Dataset(filename) try: dataset.open() datasetList.append(dataset) except IOError,e: print e # Collecting threshold value from dataset for dataset in datasetList: sampleList = dataset.phoneticList() for sample in sampleList: phonetic = Ipa.simplifySymbol(sample.phonetic) if not stat.has_key(phonetic): print "Warning! Phonetic not found in sound.csv: %s" % sample.phonetic print "It will be added to sound.csv" item = Stat() item.sound = Sound( phonetic = phonetic, ipa = phonetic, filter = "RMS", # Just the default value. It should not be used. threshold = 0, remarks = "Added by linne-tuner. Please update the filter type" ) item.threshold = item.sound.threshold stat[phonetic] = item table[phonetic] = item.sound changed = True
def __getitem__(self,key): k = Ipa.simplifySymbol(key) return self._data[k]