Updated Caper to v0.2.3 and Logr to v0.2.2 to greatly improve matching performance
This commit is contained in:
1 parent
5ea7dc5920
commit
b0e352ab6d
5 files changed
+51
-22
No files matched your search
@@ -53,8 +53,8 @@ PATTERN_GROUPS = [
|
||||
|
||||
|
||||
class AnimeParser(Parser):
|
||||
def __init__(self):
|
||||
super(AnimeParser, self).__init__(PATTERN_GROUPS)
|
||||
def __init__(self, debug=False):
|
||||
super(AnimeParser, self).__init__(PATTERN_GROUPS, debug)
|
||||
|
||||
def capture_group(self, fragment):
|
||||
match = REGEX_GROUP.match(fragment.value)
|
||||
|
||||
@@ -18,7 +18,9 @@ from caper.result import CaperResult, CaperClosureNode
|
||||
|
||||
|
||||
class Parser(object):
|
||||
def __init__(self, pattern_groups):
|
||||
def __init__(self, pattern_groups, debug=False):
|
||||
self.debug = debug
|
||||
|
||||
self.matcher = FragmentMatcher(pattern_groups)
|
||||
|
||||
self.closures = None
|
||||
|
||||
@@ -98,8 +98,8 @@ PATTERN_GROUPS = [
|
||||
|
||||
|
||||
class SceneParser(Parser):
|
||||
def __init__(self):
|
||||
super(SceneParser, self).__init__(PATTERN_GROUPS)
|
||||
def __init__(self, debug=False):
|
||||
super(SceneParser, self).__init__(PATTERN_GROUPS, debug)
|
||||
|
||||
def capture_group(self, fragment):
|
||||
if fragment.left_sep == '-' and not fragment.right:
|
||||
@@ -133,6 +133,9 @@ class SceneParser(Parser):
|
||||
return self.result
|
||||
|
||||
def print_tree(self, heads):
|
||||
if not self.debug:
|
||||
return
|
||||
|
||||
for head in heads:
|
||||
head = head if type(head) is list else [head]
|
||||
|
||||
|
||||
Reference in new issue
Block a user