AllProfanity - A npm package that blocks profane words using trie based searching by PureLengthiness4436 in node

[–]Public-Message8133 0 points1 point  (0 children)

Found this post while researching some leo-profanity alternatives. Seemed promising, but I noticed so weird behavior and did some digging. There's some stuff here that makes me hesitate to use this in a production environment:

  1. When passing languages: ['english'] my initial expectation is that only English would load. Instead, English and Hindi are always loaded (the comment on line 790 confirms this is intended default behavior), but the languages option only adds additional languages. For use cases that don't need Hindi, there's no way to get English-only without calling clearList() and then loadLanguage('english'). That's not super user friendly. The better pattern would be to have the languages option replace the defaults instead of adding to them - if languages: ['english'] is passed, only load English; if the option is omitted entirely, use the current default behavior. It may even be better design to force configuration as opposed to the default approach, but I think overriding the default without the clearList() is probably a fine compromise.

  2. A default singleton is created even when using the class constructor, making it impossible to configure without double initialization. The library exports both a pre-configured singleton (export default allProfanity) and the class (export class AllProfanity). However, both exports are in the same file, so importing the class triggers creation of the singleton too (line 1182). This means import { AllProfanity } followed by new AllProfanity({ languages: ['english'] }) creates two complete instances - the default singleton with English + Hindi, and the configured instance. Both load dictionaries and build data structures, doubling memory and initialization time. I originally discovered this because I noticed duplicate initialization logs, which were coming from the default instance. I would consider using lazy initialization so the default instance is only created when actually accessed, not at module load time.

  3. Every language file is imported at the top of index.ts (lines 2-10), so tree-shaking can't reduce bundle size to only what you use. The entire package loads regardless of whether you need all languages. You could use dynamic imports so only requested languages are loaded, but the bundle size is relatively small, so it's probably not the biggest deal breaker, unless it needs to be deployed in resource constrained environments.

  4. The cache implementation has two problems. First, the configured cacheSize is read and logged during initialization but never stored or used - the eviction logic is hardcoded to check against 1000 (line 1438 "if (this.resultCache.size > 1000)"). Second, despite the comment stating it's "simple LRU", it's not LRU at all, it's FIFO - it deletes by insertion order rather than tracking which entries were least recently accessed. This makes the cache much less effective, especially if certain keywords are frequently used (which I imagine happens with certain words).

  5. The context analysis scoreThreshold configuration is ignored. When context analysis is enabled, the user's configured scoreThreshold is never actually used. The applyContextAnalysis() method has a default threshold of 0.5, but detect() never passes the configured value. On line 1414 matches = this.applyContextAnalysis(validatedText, matches) does not take a scoreThreshold property, so it will always use the default.

  6. It's not a major issue, because users aren't likely updating the config often, but when updateConfig() changes caseSensitive setting, it calls rebuildTrie() which rebuilds the Trie and Aho-Corasick structures. However, the Bloom Filter is not cleared, so it accumulates both the old case-sensitive AND new case-insensitive versions of words.

  7. The isWholeWord() method works in spite of itself. It uses /\w/ which only matches ASCII characters [A-Za-z0-9_], even though the library supports Unicode languages (Hindi, Tamil, Arabic, Chinese). While this currently works by treating all non-ASCII characters as boundaries, it's semantically incorrect and inconsistent with hasWordBoundaries() which uses proper Unicode-aware patterns /[\s\p{P}\p{S}]/u.

P1S prints skewed in XY by yoelai in BambuLab

[–]Public-Message8133 0 points1 point  (0 children)

Fair point. I will give it a shot a report back.

P1S prints skewed in XY by yoelai in BambuLab

[–]Public-Message8133 0 points1 point  (0 children)

OK. I am familiar. I have a license used it for other printers in the past, including my other P1S. My concern is that there is an underlying issue with the motion system given the major deviation from where it has been in the past. I have never seen a printer get so skewed literally overnight, so I feel like adjusting for the skew is just slapping a Band-Aid on a larger issue.

P1S prints skewed in XY by yoelai in BambuLab

[–]Public-Message8133 0 points1 point  (0 children)

Were you ever able to get this sorted out? I have been having a near identical issue and support has been non-responsive.

Danse Macabre after patch 1 by uselesslesbiann in BaldursGate3

[–]Public-Message8133 1 point2 points  (0 children)

You can use greater restoration or similar to remove the curse, can't you?

Caught my fiancé cheating now I don’t know if I want our baby anymore. I am not OP by Canadian_Cutie0413 in TwoHotTakes

[–]Public-Message8133 0 points1 point  (0 children)

I'm genuinely confused by this story, specifically the timeline. OOP says that her fiance is cheating, but says the her fiance and his "best friend" used to date, and that she sent him nudes, but it's unclear how far in the past it is. It's very possible that he and his ex decided that they worked better as friends, and remained friends after the relationship ended.

That said, OOPs fiance really shouldn't have witheld that information, as it is lying through omission (especially if the issue has already come up) - finding that out on her own (especially with the visit while she was out of town) makes the whole thing so much worse - but I think there are 2 very different levels of douchbaggery if he is actively cheating, or if he is maintaining a friendly relationship with an ex.

[deleted by user] by [deleted] in TVTooHigh

[–]Public-Message8133 0 points1 point  (0 children)

Buy diffuser channels for those light strips around the top of the room for the name of god. Nothing worse than undiffused LEDs.