Browse Source

plus d'insultes et fix regex

pull/3/head
Figg 8 months ago
parent
commit
2862ba1a3a
2 changed files with 15 additions and 2 deletions
  1. 1
    1
      million/analyze/wordFinder.py
  2. 14
    1
      scripts/find_gromots.py

+ 1
- 1
million/analyze/wordFinder.py View File

5
 
5
 
6
 def _wordFilter(msg: Message, regexs: List[str]) -> bool:
6
 def _wordFilter(msg: Message, regexs: List[str]) -> bool:
7
     return msg.content and any(
7
     return msg.content and any(
8
-        re.search(rgx, msg.content) for rgx in regexs
8
+        re.search(rgx, msg.content, re.I) for rgx in regexs
9
         )
9
         )
10
 
10
 
11
 def findWords(messages: List[Message], words: List[str]) -> List[Message]:
11
 def findWords(messages: List[Message], words: List[str]) -> List[Message]:

+ 14
- 1
scripts/find_gromots.py View File

9
 
9
 
10
 export = parser.parse(DATA_PATH)
10
 export = parser.parse(DATA_PATH)
11
 
11
 
12
-gros_mots = ['merde', 'sexe', 'pute', 'putain', 'bite', 'nichon', 'con(ne)?', 'baiser?']
12
+gros_mots = [
13
+    '.*merde.*',
14
+    'sexe',
15
+    'pute',
16
+    'pé?dé?',
17
+    'putain',
18
+    'bite',
19
+    'encul.*',
20
+    'cul',
21
+    'nichon',
22
+    'con(ne)?',
23
+    'bais.*'
24
+    ]
25
+
13
 msg_gros_mots = findWords(export.messages, gros_mots)
26
 msg_gros_mots = findWords(export.messages, gros_mots)
14
 
27
 
15
 msg_gros_mots_grp = {}
28
 msg_gros_mots_grp = {}

Loading…
Cancel
Save