How to use the prosodic.lib.MaxEnt2.DataPoint function in prosodic

To help you get started, we’ve selected a few prosodic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github quadrismegistus / prosodic / prosodic / lib / MaxEnt2.py View on Github external
frequency = 0.0
                    else:
                        frequency = float(split[3])

                else:
                    line = line.strip()
                    split = line.split(delimeter)
                    text = split[0]
                    frequency = float(split[1])
                    scansion = split[2]

                if text not in data:
                    data[text] = []
                    self.lines+=[text]

                datum = DataPoint(text, scansion, None, frequency)
                data[text].append(datum)

        return data
github quadrismegistus / prosodic / prosodic / lib / MaxEnt2.py View on Github external
self.constraints = []
                    for constraint in constraint_violations:
                        if constraint.name in {'skip_initial_foot'}: continue
                        self.constraints.append(constraint)

                constraint_viol_count = []
                for constraint in self.constraints:
                    constraint_viol_count.append(constraint_violations[constraint] / constraint.weight)

                frequency = 0.0
                for datum in data[line]:
                    if datum.scansion == meter_str:
                        frequency = datum.frequency
                        matched = True

                data_point = DataPoint(line, meter_str, scansion_str, frequency)
                data_point.violations = constraint_viol_count
                parse_list.append(data_point)



            full_parses[line] = parse_list


        return full_parses
github quadrismegistus / prosodic / prosodic / lib / MaxEnt2.py View on Github external
def __attach_provided_data__(self,data_tuples):
        data = {}
        for line,scansion,frequency in data_tuples:
            datum = DataPoint(line, scansion, None, frequency)
            if line not in data:
                data[line]=[]
                self.lines+=[line]
            data[line].append(datum)
        return data