Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

Show HN: Grumbles.js – Detects when your users swear out loud

$
0
0

Introduction

Grumbles.js is a very simple library which can be used to determine when your user is upset by listening for when they grumble (read: shout swear words). It works via the experimental SpeechRecognition api currently available in the latest version of Chrome.

Installation

NPM


npm i -S grumbles

CDN (UMD)

<script src="https://unpkg.com/grumbles@1.0.1"></script>

Usage


const stop = grumbles(({ word, context, time }) => {
  console.log(time);    // The time the grumble was grumbled.
  console.log(word);    // The word which was grumbled.
  console.log(context); // The full phrase containing the grumble.
}, 'en'); // Language is optional and defaults to 'en'
stop(); // Call this if you ever want to stop listening.

Demo: Grumble Log

Grumble detected on {{grumble.time | moment "MMMM Do YYYY [at] h:mm:ss a"}}

Grumble: {{grumble.word}}

{{grumble.context}}

No Grumbles Detected

Note: your computer tries very hard to believe you're not grumbling at it. Try using a grumble in a sentence. For example, "Oi, what the f*** is this s***?" instead of just "F***!"

Your browser does not support the SpeechRecognition API. :(


Viewing all articles
Browse latest Browse all 25817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>