class ChoraleAnalysis(): """ Provides access to the Sebastian library. Can be serialized for use in creating an API to Sebastian. This class should not be instantiated. """ def __init__(self, XML_path, RNA_path = None): """ :param XML_path: Path to MusicXML to analyze. :param RNA_path: Optional path to RNA """ self.XML_path = XML_path self.RNA_path = RNA_path self.chorale = SebastianParser(XML_path).parse_as_chorale() self.evaluation = ChoraleEvaluation(self.chorale, self.check_list()) def analyze(self): """ Populates this chorale's evaluation with a list of errors. """ self.evaluation.evaluate() def get_error_list_all(self): """ :return: Errors from this analysis """ return self.evaluation.get_error_list_all() def get_error_list(self, error_name): """ :param error_name: Error type :return: A list of errors from this analysis of this type. """ return self.evaluation.get_error_list(error_name) def check_list(self): """ :return: A list of checks to be implemented in this analysis. Should be overridden by implementation. """ pass def get_annotated_chorale(self): """ :return: A string giving musicXML for this chorale, with colors applied for mistakes. """ self.chorale.annotate_chorale(self.get_error_list_all()) return self.chorale
def __init__(self, XML_path, RNA_path = None): """ :param XML_path: Path to MusicXML to analyze. :param RNA_path: Optional path to RNA """ self.XML_path = XML_path self.RNA_path = RNA_path self.chorale = SebastianParser(XML_path).parse_as_chorale() self.evaluation = ChoraleEvaluation(self.chorale, self.check_list())