def compute_within_collection_vowel_duration(self, prefix, no_singletons=False):
        """ Computes the mean duration of vowels from Units within clusters.

        :param str prefix: Prefix for the key entry in self.measures
        :param bool no_singletons: If False, excludes collections of length 1 from calculations
            and adds "no_singletons" to the prefix

        Adds the following measures to the self.measures dictionary:
            - TIMING_(similarity_measure)_(collection_type)_within_collection_vowel_duration_mean
        """

        if no_singletons:
            min_size = 2
        else:
            prefix += "no_singletons_"
            min_size = 1

        durations = []
        for cluster in self.collection_list:
            if len(cluster) >= min_size:
                for word in cluster:
                    word = self.full_timed_response[word.index_in_timed_response]
                    for phone in word.phones:
                        if phone.string in self.vowels:
                            durations.append(phone.end - phone.start)

        self.measures[prefix + 'within_collection_vowel_duration_mean'] = get_mean(durations) \
            if len(durations) > 0 else 'NA'

        if not self.quiet:
            if no_singletons:
                print "Mean within-" + self.current_similarity_measure + "-" + self.current_collection_type + \
                      " vowel duration, excluding singletons:", \
                    self.measures[prefix + 'within_collection_vowel_duration_mean']
            else:
                print "Mean within-" + self.current_similarity_measure + "-" + self.current_collection_type + \
                      " vowel duration, including singletons:", \
                    self.measures[prefix + 'within_collection_vowel_duration_mean']
def compute_within_collection_vowel_duration ( self , prefix , no_singletons = False ) : if no_singletons : min_size = 2 else : prefix += "no_singletons_" min_size = 1 durations = [ ] for cluster in self . collection_list : if len ( cluster ) >= min_size : for word in cluster : word = self . full_timed_response [ word . index_in_timed_response ] for phone in word . phones : if phone . string in self . vowels : durations . append ( phone . end - phone . start ) self . measures [ prefix + 'within_collection_vowel_duration_mean' ] = get_mean ( durations ) if len ( durations ) > 0 else 'NA' if not self . quiet : if no_singletons : print "Mean within-" + self . current_similarity_measure + "-" + self . current_collection_type + " vowel duration, excluding singletons:" , self . measures [ prefix + 'within_collection_vowel_duration_mean' ] else : print "Mean within-" + self . current_similarity_measure + "-" + self . current_collection_type + " vowel duration, including singletons:" , self . measures [ prefix + 'within_collection_vowel_duration_mean' ]
Computes the mean duration of vowels from Units within clusters.

        :param str prefix: Prefix for the key entry in self.measures
        :param bool no_singletons: If False, excludes collections of length 1 from calculations
            and adds "no_singletons" to the prefix

        Adds the following measures to the self.measures dictionary:
            - TIMING_(similarity_measure)_(collection_type)_within_collection_vowel_duration_mean