diff --git a/padaos.py b/padaos.py index 21c8529..bc7b80c 100644 --- a/padaos.py +++ b/padaos.py @@ -37,6 +37,7 @@ def remove_entity(self, name): del self.entity_lines[name] def _create_pattern(self, line): + line = line.lower() for pat, rep in ( # === Preserve Plain Parentheses === (r'\(([^\|)]*)\)', r'{~(\1)~}'), # (hi) -> {~(hi)~} diff --git a/test_padaos.py b/test_padaos.py index f9d5a8e..385d8ab 100644 --- a/test_padaos.py +++ b/test_padaos.py @@ -35,6 +35,12 @@ def test_case(self): self.container.add_intent('test', ['Testing cAPitalizAtion']) assert self.container.calc_intent('teStiNg CapitalIzation')['name'] == 'test' + self.container.add_intent('test2', ['test THE {CaSe}']) + self.container.compile() + intent = self.container.calc_intent('test the cAPitalizAtion') + assert intent["name"] == 'test2' + assert intent['entities'] == {'case': 'cAPitalizAtion'} + def test_punctuation(self): self.container.add_intent('test', ['Test! Of: Punctuation']) assert self.container.calc_intent('test of !punctuation...')['name'] == 'test'