derek-thomas HF staff commited on
Commit
e1aa772
1 Parent(s): 31a4689

Fixing regex

Browse files
Files changed (1) hide show
  1. src/build_nomic.py +1 -2
src/build_nomic.py CHANGED
@@ -19,7 +19,6 @@ logger = setup_logger(__name__)
19
 
20
  # Regex to extract subreddit
21
  subreddit_re = re.compile(r'r/(\w+)')
22
- spoiler_re = re.compile(r'\>\!(.*?)\<\!',)
23
 
24
 
25
  def count_words(text):
@@ -33,7 +32,7 @@ def preprocess_markdown(text):
33
  hover_style = 'color: inherit;' # Assuming you want the text to be visible on hover
34
 
35
  # Replace Reddit spoiler tags with an HTML span with inline styles
36
- text = spoiler_re.sub(
37
  r'\>\!(.*?)\!\<',
38
  r'<span class="spoiler" style="' + spoiler_style + '" onmouseover="this.style.color=\'' + hover_style + '\'" onmouseout="this.style.color=\'black\'">\1</span>',
39
  text
 
19
 
20
  # Regex to extract subreddit
21
  subreddit_re = re.compile(r'r/(\w+)')
 
22
 
23
 
24
  def count_words(text):
 
32
  hover_style = 'color: inherit;' # Assuming you want the text to be visible on hover
33
 
34
  # Replace Reddit spoiler tags with an HTML span with inline styles
35
+ text = re.sub(
36
  r'\>\!(.*?)\!\<',
37
  r'<span class="spoiler" style="' + spoiler_style + '" onmouseover="this.style.color=\'' + hover_style + '\'" onmouseout="this.style.color=\'black\'">\1</span>',
38
  text