File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,8 +53,11 @@ def make_op_regex(o):
5353class KarmaParser (TextParsers ):
5454 anything = reg (r"." ) > constant (None )
5555
56+ quotes = reg (r'["“”]' )
57+
5658 word_topic = reg (r'[^"\s]+?(?=[+-]{2})' )
57- string_topic = reg (r'".*?(?<!\\)(\\\\)*?"(?=[+-]{2})' )
59+ string_topic = quotes & reg (r".*?(?<!\\)(\\\\)*?" ) & quotes & reg (r"(?=[+-]{2})" )
60+
5861 topic = (word_topic > (lambda t : [t , False ])) | (
5962 string_topic > (lambda t : [t [1 :- 1 ], True ])
6063 )
@@ -67,7 +70,9 @@ class KarmaParser(TextParsers):
6770 operator = op_positive | op_neutral | op_negative
6871
6972 bracket_reason = reg (r"\(.+?\)" ) > (lambda s : s [1 :- 1 ])
70- quote_reason = reg (r'".*?(?<!\\)(\\\\)*?"(?![+-]{2})' ) > (lambda s : s [1 :- 1 ])
73+ quote_reason = reg (r"\".*?(?<!\\)(\\\\)*?\"(?![+-]{2})" ) > (
74+ lambda s : s [1 :- 1 ]
75+ )
7176 reason_words = reg (r"(?i)because" ) | reg (r"(?i)for" )
7277 text_reason = reason_words >> (reg (r'[^",]+' ) | quote_reason )
7378 reason = bracket_reason | quote_reason | text_reason
You can’t perform that action at this time.
0 commit comments