Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yakafokon: simplification de la regex et correction du cas "ça serait bien" #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/alain/alain3.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def lol(self, mask=None, channel=None, data=None):

@irc3.event(
r":(?P<mask>\S+) PRIVMSG {channel} :"
r".*\s(faudrai.|faut|ca serait bien que)\s+qu.*"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi enlever ce \s ? Il a du sens pour moi, pour éviter des faux positifs comme "arguments par défaut qui sont None"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je me dis qu'une alternative, si on veut reconnaître "faut que..." après un espace mais aussi en début de ligne, serait de mettre \b (frontière de mot) avant le motif.

\b Matches the empty string, but only at the beginning or end of a word.

https://docs.python.org/3/library/re.html

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vendu pour \b. Tu as raison ça règle plein de cas, comme (faut que qu'on merge ça).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai pas encore eu l'occasion de m'en occuper, je fais ça plus tard.

r".*(faudrai.|faut|[scç]a serai.? bien)\s+qu.*"
)
def yakafokon(self, mask=None, channel=None, data=None):
message = "WARNING !!! YAKAFOKON DETECTED !!!!"
Expand Down