All Projects → aralroca → react-text-toxicity

aralroca / react-text-toxicity

Licence: other
Detect text toxicity in a simple way, using React. Based in a Keras model, loaded with Tensorflow.js.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-text-toxicity

robinjs-website
Alexa like assistant in 40 lines of code
Stars: ✭ 31 (-18.42%)
Mutual labels:  preact
text-image
Convert text to image https://vincent7128.github.io/text-image/
Stars: ✭ 64 (+68.42%)
Mutual labels:  text
als typograf
Ruby client for ArtLebedevStudio.RemoteTypograf Web Service.
Stars: ✭ 15 (-60.53%)
Mutual labels:  text
privacy-policy-template
Privacy Policy Template for website or app
Stars: ✭ 64 (+68.42%)
Mutual labels:  text
preact-coffee
Starter template for preact coffee webpack
Stars: ✭ 13 (-65.79%)
Mutual labels:  preact
preact-motion
A fork of React-Motion to be used with Preact
Stars: ✭ 28 (-26.32%)
Mutual labels:  preact
universal-progressive-todos
A Todo list with universal JavaScript & Progressive Enhancement
Stars: ✭ 30 (-21.05%)
Mutual labels:  preact
text-display
A Typeclass for user-facing output
Stars: ✭ 45 (+18.42%)
Mutual labels:  text
table
Produces a string that represents slice data in a text table, inspired by gajus/table.
Stars: ✭ 130 (+242.11%)
Mutual labels:  text
precharts
Just Recharts pre-aliased for Preact.
Stars: ✭ 26 (-31.58%)
Mutual labels:  preact
preact-token-input
🔖 A text field that tokenizes input, for things like tags.
Stars: ✭ 57 (+50%)
Mutual labels:  preact
edits.cr
Edit distance algorithms inc. Jaro, Damerau-Levenshtein, and Optimal Alignment
Stars: ✭ 16 (-57.89%)
Mutual labels:  text
text-editor
A text selection range API written in pure JavaScript, for modern browsers.
Stars: ✭ 24 (-36.84%)
Mutual labels:  text
relaks
Asynchrounous React component
Stars: ✭ 49 (+28.95%)
Mutual labels:  preact
classy
Super simple text classifier using Naive Bayes. Plug-and-play, no dependencies
Stars: ✭ 12 (-68.42%)
Mutual labels:  text
coderplex
(Old) Frontend for coderplex.org
Stars: ✭ 40 (+5.26%)
Mutual labels:  preact
chisel
A library to sculpt text on any device that you can handle pixels
Stars: ✭ 37 (-2.63%)
Mutual labels:  text
flowrisk
A Python Implementation of Measures for Order Flow Risk, e.g. VPIN
Stars: ✭ 53 (+39.47%)
Mutual labels:  toxicity
vue-scrollin
🎰 Scroll-in text component for Vue
Stars: ✭ 61 (+60.53%)
Mutual labels:  text
vue-responsive-text
↔ Vue component that scales its child node in relation to its parent node's width
Stars: ✭ 23 (-39.47%)
Mutual labels:  text

React Text Toxicity

Detect toxicity in text using React.

It's based on this model: https://github.com/tensorflow/tfjs-models/tree/master/toxicity

Getting started

yarn add react-text-toxicity

Import as:

import useTextToxicity from "react-text-toxicity";

Use it as:

const predictions = useTextToxicity('text', { threshold, delay });
  • text - Text to predict
  • options
    • threshold Prediction threshold (0.9 as default)
    • delay Delay in milliseconds applied to debounce multiple changes (300ms as default)

Example

example

import React, { Fragment, useState } from "react";
import useTextToxicity from "react-text-toxicity";

function Toxicity({ predictions }) {
  const style = { margin: 10 };

  if (!predictions) return <div style={style}>Loading predictions...</div>;

  return (
    <div style={style}>
      {predictions.map(({ label, match, probability }) => (
        <div style={{ margin: 5 }} key={label}>
          {`${label} - ${probability} - ${match ? "🤢" : "🥰"}`}
        </div>
      ))}
    </div>
  );
}

export default function Index() {
  const [value, setValue] = useState("");
  const predictions = useTextToxicity(value);

  return (
    <div style={{ display: "flex" }}>
      <div>
        <div>Write something</div>
        <textarea
          style={{ width: 300, height: 200 }}
          value={value}
          onChange={(e) => setValue(e.target.value)}
        />
      </div>
      {value && <Toxicity predictions={predictions} />}
    </div>
  );
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].