Unable to load image

Loggedoutcels can no longer view NSFW posts, posts in /h/sandshit, and posts and comments containing certain words related to Middle Eastern conflicts

https://fsdfsd.net/rDrama/rDrama/commit/317bea3f843017f2e03461ed8a61568c528005ac

It's over for the logged out. Maybe there were too many calls for genocide. I purposefully did not write out the list so this post wouldn't be hidden as well.

55
Jump in the discussion.

No email address required.

if any((x in other.body.lower() for x in words_to_hide)):

scans the entire post body once for each no-no word

Capyyyyyyy :marseyraging:

Trans lives matter

Jump in the discussion.

No email address required.

@A here you go, free for you

naughty = set(words_to_hide)
if any((x in naughty for x in other.body.lower().split(' ')))

Trans lives matter (unchud pls)

Jump in the discussion.

No email address required.

thats worse

"palestinian" wouldnt get matched for example

Jump in the discussion.

No email address required.

Of course you would make it harder to do quickly because you're too lazy to write down the five suffixes. 

:#chudtantrum:

https://en.wikipedia.org/wiki/Radix_tree

Not as sure I want to write it for you anymore but it would definitely be faster.

TRANS LIVES MATTER

Jump in the discussion.

No email address required.

literally saving a couple of milliseconds

Jump in the discussion.

No email address required.

On every post, on every page load

You could also add hundreds more nono words after that

Trans lives matter

Jump in the discussion.

No email address required.

Came to collect my L

import string
import random
from time import perf_counter

bodies = (''.join((random.choice(string.ascii_lowercase + ' ') for _ in range(500))) for _ in range(50))
words_to_hide = (''.join((random.choice(string.ascii_lowercase) for _ in range(random.choice(range(5, 12))))) for _ in range(50))

tic = perf_counter()
for body in bodies:
    found = any(x in body for x in words_to_hide)
toc = perf_counter()

print("MS", round((toc-tic)*1000))

Takes ~15 millis to check for 50 words of length 5-12 in 50 posts of length 500 each. I kneel before pythonchads

:#marseykneel:

trans lives matter

Jump in the discussion.

No email address required.

https://github.com/TheAlgorithms/python/blob/master/data_structures%2Ftrie%2Fradix_tree.py#L122

If you remove this line so that you can match on partial words, you could load the post body into the radix tree one time and then try to find each nono word

Trans lives matter

Jump in the discussion.

No email address required.

The current method does have some false positives though. Words like "jewel" and "crisis" would be hidden, for example.

These are all the word variants I could think of.

'israel', 'israeli', 'israelis', 'isreal', 'palestine', 'palestinian', 'palestinians', 'muslim', 'muslims', 'islam', 'islamic', 'hamas', 'jew', 'jews', 'jewish', 'gaza', 'gazan', 'rafah', 'isis', 'terror', 'terrorism', 'terrorist', 'terrorists', 'iraq', 'iraqi', 'iraqis'

Jump in the discussion.

No email address required.

Hey sexy, why are you posting so quickly? 😊 You almost forgot to include trans lives matter in your comment 😈. Slowww down and remember to post trans lives matter next time 😉 if that doesn't make sense stop by sometime and we can talk about it for a while 🥵

Jump in the discussion.

No email address required.

Hey sexy, why are you posting so quickly? 😊 You almost forgot to include trans lives matter in your comment 😈. Slowww down and remember to post trans lives matter next time 😉 if that doesn't make sense stop by sometime and we can talk about it for a while 🥵

Jump in the discussion.

No email address required.

the optimizer takes care of it anyway, r-slur

Jump in the discussion.

No email address required.

Maybe you meant that it will stop as soon as a word matches. Which is cool functional laziness. But i think it will do a dozen scans of the post body if it has  no chudwords

Trans lives matter

Jump in the discussion.

No email address required.

the what

Jump in the discussion.

No email address required.

It rewrites your shitty code in such a way that it'll by faster while still making exactly the same mistakes (and a few additional ones for good measure)

Jump in the discussion.

No email address required.

sounds r-slurred ngl

Jump in the discussion.

No email address required.

xar you from india too? kindly send armpit pic ASAP for proof

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/1708063196162245.webp

Jump in the discussion.

No email address required.

:marseypajeetitsover#:

Jump in the discussion.

No email address required.

i dont write python because im not a pothead but this ai says youre retarded

Generative AI is experimental. Learn more

No, checking each member of a list against a large string using in in Python will not be optimized to linear time. The in operator in Python has a time complexity of O(n), where n is the length of the list. This is because the in operator iterates over the entire list to check if the element is present.

It mixed up the string and the list though. Are you saying it will turn the string into a set?

Trans lives matter

Jump in the discussion.

No email address required.

i write O(m*n) logic on purpose because I know it'll get optimized

:#marseyclueless:

Trans lives matter

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.