<commit_before>class Verb(object):
    """Represents a single verb in TwilML. """

    def __init__(self, verb, attributes={}, nouns={}):
        self.verb = verb
        self.attributes = attributes
        self.nouns = nouns<commit_msg>Add basic parser<commit_after>import xml.etree.ElementTree as ET


class Verb(object):
    """Represents a single verb in TwilML. """

    def __init__(self, verb, attributes={}, nouns={}):
        self.verb = verb
        self.attributes = attributes
        self.nouns = nouns


class TwilMLParseError(Exception):
    """Raised when trying to parse invalid TwilML"""


class TwilMLParser(object):
    """Parser for TwilML"""

    def parse_xml(self, xml):
        """Parses TwilML and returns a list of :class:`Verb` objects"""
        verbs = []
        root = ET.fromstring(xml)
        if root.tag != "Response":
            raise TwilMLParseError(
                "Invalid root %r. Should be 'Request'." % root.tag)
        for child in root:
            parser = getattr(
                self, '_parse_%s' % child.tag, self._parse_default)
            verbs.append(parser(child))
        return verbs

    def _parse_default(self, element):
        raise TwilMLParseError("Unable to parse verb %r" % element.tag)
{'fraction_non_alphanumeric': 0.1177406523468576, 'fraction_numerical': 0.0, 'mean_word_length': 2.533707865168539, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2865608', 'n_tokens_mistral': 384, 'n_tokens_neox': 367, 'n_words': 107}