Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions padaos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)~}
Expand Down
6 changes: 6 additions & 0 deletions test_padaos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down