add regex;

This commit is contained in:
Chrys 2019-10-22 00:45:38 +02:00
parent aa5bb94237
commit 981bf85cf0
7 changed files with 137 additions and 130 deletions

View File

@ -44,29 +44,30 @@ _:===:Lienie unten
=:===:Istgleich =:===:Istgleich
[customDict] [customDict]
[emoticonDict] [emoticonDict]
# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. # This dictionary uses regexp when prefixed with "regex;", so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc.
[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves regex;[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves
[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses
[\s*|'|"][\s*|'|"]:-/:===:confused regex;[\s*|'|"][\s*|'|"]:-/:===:confused
[\s*|'|"][\s*|'|"]-\.-:===:bugged regex;[\s*|'|"][\s*|'|"]-\.-:===:bugged
[\s*|'|"][\s*|'|"]>\.<:===:laughing regex;[\s*|'|"][\s*|'|"]>\.<:===:laughing
[\s*|'|"][\s*|'|"]8-X:===:skull regex;[\s*|'|"][\s*|'|"]8-X:===:skull
[\s*|'|"][\s*|'|"]>:\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:\):===:evil smile
[\s*|'|"][\s*|'|"]>:-\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:-\):===:evil smile
[\s*|'|"][\s*|'|"]\\o/:===:Hurray regex;[\s*|'|"][\s*|'|"]\\o/:===:Hurray
[\s*|'|"][\s*|'|"]:/:===:confused regex;[\s*|'|"][\s*|'|"]:/:===:confused
[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses
[\s*|'|"]:D[\s*|'|"]:===:laugh regex;[\s*|'|"]:D[\s*|'|"]:===:laugh
[\s*|'|"];\)[\s*|'|"]:===:wink regex;[\s*|'|"];\)[\s*|'|"]:===:wink
[\s*|'|"]XD[\s*|'|"]:===:LOL regex;[\s*|'|"]XD[\s*|'|"]:===:LOL
[\s*|'|"]:-\)[\s*|'|"]:===:smile regex;[\s*|'|"]:-\)[\s*|'|"]:===:smile
[\s*|'|"]:\)[\s*|'|"]:===:smile regex;[\s*|'|"]:\)[\s*|'|"]:===:smile
[\s*|'|"]->[\s*|'|"]:===:arrow right regex;[\s*|'|"]->[\s*|'|"]:===:arrow right
# example for arrow left # example for arrow left
#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left #(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left
# or # or
#([ |^])<-([ ,.!?$]):===:arrow left\2 #([ |^])<-([ ,.!?$]):===:arrow left\2
[\s*|'|"]<-[\s*|'|"]:===:arrow left regex;[\s*|'|"]<-[\s*|'|"]:===:arrow left
[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? regex;[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF?
[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile regex;[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile

View File

@ -44,31 +44,30 @@ _:===:line
=:===:equals =:===:equals
[customDict] [customDict]
# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc.
[emoticonDict] [emoticonDict]
# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. # This dictionary uses regexp when prefixed with "regex;", so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc.
[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves regex;[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves
[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses
[\s*|'|"][\s*|'|"]:-/:===:confused regex;[\s*|'|"][\s*|'|"]:-/:===:confused
[\s*|'|"][\s*|'|"]-\.-:===:bugged regex;[\s*|'|"][\s*|'|"]-\.-:===:bugged
[\s*|'|"][\s*|'|"]>\.<:===:laughing regex;[\s*|'|"][\s*|'|"]>\.<:===:laughing
[\s*|'|"][\s*|'|"]8-X:===:skull regex;[\s*|'|"][\s*|'|"]8-X:===:skull
[\s*|'|"][\s*|'|"]>:\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:\):===:evil smile
[\s*|'|"][\s*|'|"]>:-\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:-\):===:evil smile
[\s*|'|"][\s*|'|"]\\o/:===:Hurray regex;[\s*|'|"][\s*|'|"]\\o/:===:Hurray
[\s*|'|"][\s*|'|"]:/:===:confused regex;[\s*|'|"][\s*|'|"]:/:===:confused
[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses
[\s*|'|"]:D[\s*|'|"]:===:laugh regex;[\s*|'|"]:D[\s*|'|"]:===:laugh
[\s*|'|"];\)[\s*|'|"]:===:wink regex;[\s*|'|"];\)[\s*|'|"]:===:wink
[\s*|'|"]XD[\s*|'|"]:===:LOL regex;[\s*|'|"]XD[\s*|'|"]:===:LOL
[\s*|'|"]:-\)[\s*|'|"]:===:smile regex;[\s*|'|"]:-\)[\s*|'|"]:===:smile
[\s*|'|"]:\)[\s*|'|"]:===:smile regex;[\s*|'|"]:\)[\s*|'|"]:===:smile
[\s*|'|"]->[\s*|'|"]:===:arrow right regex;[\s*|'|"]->[\s*|'|"]:===:arrow right
# example for arrow left # example for arrow left
#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left #(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left
# or # or
#([ |^])<-([ ,.!?$]):===:arrow left\2 #([ |^])<-([ ,.!?$]):===:arrow left\2
[\s*|'|"]<-[\s*|'|"]:===:arrow left regex;[\s*|'|"]<-[\s*|'|"]:===:arrow left
[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? regex;[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF?
[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile regex;[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile

View File

@ -44,29 +44,30 @@ _:===:line
=:===:equals =:===:equals
[customDict] [customDict]
[emoticonDict] [emoticonDict]
# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. # This dictionary uses regexp when prefixed with "regex;", so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc.
[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves regex;[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves
[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses
[\s*|'|"][\s*|'|"]:-/:===:confused regex;[\s*|'|"][\s*|'|"]:-/:===:confused
[\s*|'|"][\s*|'|"]-\.-:===:bugged regex;[\s*|'|"][\s*|'|"]-\.-:===:bugged
[\s*|'|"][\s*|'|"]>\.<:===:laughing regex;[\s*|'|"][\s*|'|"]>\.<:===:laughing
[\s*|'|"][\s*|'|"]8-X:===:skull regex;[\s*|'|"][\s*|'|"]8-X:===:skull
[\s*|'|"][\s*|'|"]>:\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:\):===:evil smile
[\s*|'|"][\s*|'|"]>:-\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:-\):===:evil smile
[\s*|'|"][\s*|'|"]\\o/:===:Hurray regex;[\s*|'|"][\s*|'|"]\\o/:===:Hurray
[\s*|'|"][\s*|'|"]:/:===:confused regex;[\s*|'|"][\s*|'|"]:/:===:confused
[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses
[\s*|'|"]:D[\s*|'|"]:===:laugh regex;[\s*|'|"]:D[\s*|'|"]:===:laugh
[\s*|'|"];\)[\s*|'|"]:===:wink regex;[\s*|'|"];\)[\s*|'|"]:===:wink
[\s*|'|"]XD[\s*|'|"]:===:LOL regex;[\s*|'|"]XD[\s*|'|"]:===:LOL
[\s*|'|"]:-\)[\s*|'|"]:===:smile regex;[\s*|'|"]:-\)[\s*|'|"]:===:smile
[\s*|'|"]:\)[\s*|'|"]:===:smile regex;[\s*|'|"]:\)[\s*|'|"]:===:smile
[\s*|'|"]->[\s*|'|"]:===:arrow right regex;[\s*|'|"]->[\s*|'|"]:===:arrow right
# example for arrow left # example for arrow left
#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left #(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left
# or # or
#([ |^])<-([ ,.!?$]):===:arrow left\2 #([ |^])<-([ ,.!?$]):===:arrow left\2
[\s*|'|"]<-[\s*|'|"]:===:arrow left regex;[\s*|'|"]<-[\s*|'|"]:===:arrow left
[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? regex;[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF?
[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile regex;[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile

View File

@ -44,29 +44,30 @@ _:===:subrayado
=:===:igual =:===:igual
[customDict] [customDict]
[emoticonDict] [emoticonDict]
# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. # This dictionary uses regexp when prefixed with "regex;", so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc.
[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves regex;[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves
[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses
[\s*|'|"][\s*|'|"]:-/:===:confused regex;[\s*|'|"][\s*|'|"]:-/:===:confused
[\s*|'|"][\s*|'|"]-\.-:===:bugged regex;[\s*|'|"][\s*|'|"]-\.-:===:bugged
[\s*|'|"][\s*|'|"]>\.<:===:laughing regex;[\s*|'|"][\s*|'|"]>\.<:===:laughing
[\s*|'|"][\s*|'|"]8-X:===:skull regex;[\s*|'|"][\s*|'|"]8-X:===:skull
[\s*|'|"][\s*|'|"]>:\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:\):===:evil smile
[\s*|'|"][\s*|'|"]>:-\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:-\):===:evil smile
[\s*|'|"][\s*|'|"]\\o/:===:Hurray regex;[\s*|'|"][\s*|'|"]\\o/:===:Hurray
[\s*|'|"][\s*|'|"]:/:===:confused regex;[\s*|'|"][\s*|'|"]:/:===:confused
[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses
[\s*|'|"]:D[\s*|'|"]:===:laugh regex;[\s*|'|"]:D[\s*|'|"]:===:laugh
[\s*|'|"];\)[\s*|'|"]:===:wink regex;[\s*|'|"];\)[\s*|'|"]:===:wink
[\s*|'|"]XD[\s*|'|"]:===:LOL regex;[\s*|'|"]XD[\s*|'|"]:===:LOL
[\s*|'|"]:-\)[\s*|'|"]:===:smile regex;[\s*|'|"]:-\)[\s*|'|"]:===:smile
[\s*|'|"]:\)[\s*|'|"]:===:smile regex;[\s*|'|"]:\)[\s*|'|"]:===:smile
[\s*|'|"]->[\s*|'|"]:===:arrow right regex;[\s*|'|"]->[\s*|'|"]:===:arrow right
# example for arrow left # example for arrow left
#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left #(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left
# or # or
#([ |^])<-([ ,.!?$]):===:arrow left\2 #([ |^])<-([ ,.!?$]):===:arrow left\2
[\s*|'|"]<-[\s*|'|"]:===:arrow left regex;[\s*|'|"]<-[\s*|'|"]:===:arrow left
[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? regex;[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF?
[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile regex;[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile

View File

@ -44,29 +44,30 @@ _:===:souligné
=:===:égale à =:===:égale à
[customDict] [customDict]
[emoticonDict] [emoticonDict]
# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. # This dictionary uses regexp when prefixed with "regex;", so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc.
[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves regex;[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves
[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses
[\s*|'|"][\s*|'|"]:-/:===:confused regex;[\s*|'|"][\s*|'|"]:-/:===:confused
[\s*|'|"][\s*|'|"]-\.-:===:bugged regex;[\s*|'|"][\s*|'|"]-\.-:===:bugged
[\s*|'|"][\s*|'|"]>\.<:===:laughing regex;[\s*|'|"][\s*|'|"]>\.<:===:laughing
[\s*|'|"][\s*|'|"]8-X:===:skull regex;[\s*|'|"][\s*|'|"]8-X:===:skull
[\s*|'|"][\s*|'|"]>:\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:\):===:evil smile
[\s*|'|"][\s*|'|"]>:-\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:-\):===:evil smile
[\s*|'|"][\s*|'|"]\\o/:===:Hurray regex;[\s*|'|"][\s*|'|"]\\o/:===:Hurray
[\s*|'|"][\s*|'|"]:/:===:confused regex;[\s*|'|"][\s*|'|"]:/:===:confused
[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses
[\s*|'|"]:D[\s*|'|"]:===:laugh regex;[\s*|'|"]:D[\s*|'|"]:===:laugh
[\s*|'|"];\)[\s*|'|"]:===:wink regex;[\s*|'|"];\)[\s*|'|"]:===:wink
[\s*|'|"]XD[\s*|'|"]:===:LOL regex;[\s*|'|"]XD[\s*|'|"]:===:LOL
[\s*|'|"]:-\)[\s*|'|"]:===:smile regex;[\s*|'|"]:-\)[\s*|'|"]:===:smile
[\s*|'|"]:\)[\s*|'|"]:===:smile regex;[\s*|'|"]:\)[\s*|'|"]:===:smile
[\s*|'|"]->[\s*|'|"]:===:arrow right regex;[\s*|'|"]->[\s*|'|"]:===:arrow right
# example for arrow left # example for arrow left
#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left #(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left
# or # or
#([ |^])<-([ ,.!?$]):===:arrow left\2 #([ |^])<-([ ,.!?$]):===:arrow left\2
[\s*|'|"]<-[\s*|'|"]:===:arrow left regex;[\s*|'|"]<-[\s*|'|"]:===:arrow left
[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? regex;[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF?
[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile regex;[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile

View File

@ -44,29 +44,30 @@ _:===:podkreślnik
=:===:równa się =:===:równa się
[customDict] [customDict]
[emoticonDict] [emoticonDict]
# This dictionary uses regexp, so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc. # This dictionary uses regexp when prefixed with "regex;", so be sure to escape anything that would be parsed by regexp, e.g. *, ., ^, $, etc.
[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves regex;[\s*|'|"][\s*|'|"]<{-.-}>:===:Raves
[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8-\):===:smile with sunglasses
[\s*|'|"][\s*|'|"]:-/:===:confused regex;[\s*|'|"][\s*|'|"]:-/:===:confused
[\s*|'|"][\s*|'|"]-\.-:===:bugged regex;[\s*|'|"][\s*|'|"]-\.-:===:bugged
[\s*|'|"][\s*|'|"]>\.<:===:laughing regex;[\s*|'|"][\s*|'|"]>\.<:===:laughing
[\s*|'|"][\s*|'|"]8-X:===:skull regex;[\s*|'|"][\s*|'|"]8-X:===:skull
[\s*|'|"][\s*|'|"]>:\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:\):===:evil smile
[\s*|'|"][\s*|'|"]>:-\):===:evil smile regex;[\s*|'|"][\s*|'|"]>:-\):===:evil smile
[\s*|'|"][\s*|'|"]\\o/:===:Hurray regex;[\s*|'|"][\s*|'|"]\\o/:===:Hurray
[\s*|'|"][\s*|'|"]:/:===:confused regex;[\s*|'|"][\s*|'|"]:/:===:confused
[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses regex;[\s*|'|"][\s*|'|"]8\):===:smile with sunglasses
[\s*|'|"]:D[\s*|'|"]:===:laugh regex;[\s*|'|"]:D[\s*|'|"]:===:laugh
[\s*|'|"];\)[\s*|'|"]:===:wink regex;[\s*|'|"];\)[\s*|'|"]:===:wink
[\s*|'|"]XD[\s*|'|"]:===:LOL regex;[\s*|'|"]XD[\s*|'|"]:===:LOL
[\s*|'|"]:-\)[\s*|'|"]:===:smile regex;[\s*|'|"]:-\)[\s*|'|"]:===:smile
[\s*|'|"]:\)[\s*|'|"]:===:smile regex;[\s*|'|"]:\)[\s*|'|"]:===:smile
[\s*|'|"]->[\s*|'|"]:===:arrow right regex;[\s*|'|"]->[\s*|'|"]:===:arrow right
# example for arrow left # example for arrow left
#(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left #(?:[ |^])(<-)(?:[ ,.!?$]):===:arrow left
# or # or
#([ |^])<-([ ,.!?$]):===:arrow left\2 #([ |^])<-([ ,.!?$]):===:arrow left\2
[\s*|'|"]<-[\s*|'|"]:===:arrow left regex;[\s*|'|"]<-[\s*|'|"]:===:arrow left
[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF? regex;[\s*|'|"][O|o][O|o][\s*|'|"]:===:WTF?
[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile regex;[\s*|'|"]\^\^[\s*|'|"]:===:enjoy smile

View File

@ -39,9 +39,12 @@ class punctuationManager():
if customDict: if customDict:
for key,item in customDict.items(): for key,item in customDict.items():
try: try:
resultText = re.sub(str(key), seperator + str(item) + seperator, resultText) if item.upper().startswith('REGEX;') and (len(item) > 6):
except: resultText = re.sub(str(key), seperator + str(item[6:]) + seperator, resultText)
else:
resultText = resultText.replace(str(key),seperator + str(item) + seperator) resultText = resultText.replace(str(key),seperator + str(item) + seperator)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut("useCustomDict replace:'" + key + "' with '" + item +"' failed:" + str(e),debug.debugLevel.ERROR, onAnyLevel=False)
return resultText return resultText
def usePunctuationDict(self, text, punctuationDict, punctuation): def usePunctuationDict(self, text, punctuationDict, punctuation):
resultText = str(text) resultText = str(text)