Coder Social home page Coder Social logo

Typing in Context? about rustrict HOT 4 CLOSED

callmeclover avatar callmeclover commented on June 14, 2024 1
Typing in Context?

from rustrict.

Comments (4)

callmeclover avatar callmeclover commented on June 14, 2024 1

Alright then, I mean, the features wouldn't really be hard to implement myself, so I suppose I'll just swap out with a basic Censor.

from rustrict.

finnbear avatar finnbear commented on June 14, 2024

The API for censoring a specific rustrict::Type works like this:

let censored = rustrict::Censor::from_str("some input")
    .with_censor_threshold(typ)
    .with_censor_first_character_threshold(typ) // optional
    .censor();

As for the value of typ, consider the following options:

  • rustrict::Type::SEVERE | rustrict::Type::OFFENSIVE includes
    • mildly offensive
    • moderately offensive
    • severely offensive
    • severely profane
    • severely sexual
    • severely mean
    • severely evasive
    • severely spammy
    • severely [any future category]
  • rustrict::Type::SEVERE & rustrict::Type::OFFENSIVE includes
    • severely offensive

If you want something other than those two options, please describe it!

from rustrict.

callmeclover avatar callmeclover commented on June 14, 2024

Does this still work with Context? Would it just be

...process()
    .with_censor_threshold(typ)
    .with_censor_first_character_threshold(typ)

or is there some other way to implement this?

from rustrict.

finnbear avatar finnbear commented on June 14, 2024

Ah, I see. That's not currently possible. Context selects a Type at runtime, depending on message history.

While the following advice isn't documented anywhere, I recommend using Context as a model of how to use rustrict, that you can copy and adapt. It only makes sense to use rustrict::Context in your application if you have very similar needs as me. I've received some good advice that it should be removed from the library, possibly leaving it in examples.

from rustrict.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.