Raspberry Pi ‘Swear Bear’ keeps your potty mouth in check

Why use a regular swear jar to retrain your potty-mouthed brain when you can build a Swear Bear to help you instead?

Swear Bear listens to you. All the time. And Swear Bear can tell when a swear word is used. Swear Bear tells you off and saves all the swear words you said to the cloud to shame you. Swear Bear subscribes to the school of tough love.

Artificial intelligence

The Google AIY kit allows you to build your own natural language recogniser. This page shows you how to assemble the Voice HAT from the kit, and it also includes the code you’ll need to make your project capable of speech-to-text AI.

Black AIY HAT stuck on top of a Raspberry Pi
Image of the Voice HAT mounted onto a Raspberry Pi 3 courtesy of aiyprojects.withgoogle.com

To teach Swear Bear the art of profanity detection, Swear Bear creators 8 Bits and a Byte turned to the profanity check Python library. You can find the info to install and use the library on this page, as well as info on how it works and why it’s so accurate.

You’ll hear at this point in the video that Swear Bear says “Oh dear” when a swear word is used within earshot.

Hardware

Birds eye view of each of the hardware components used in the project on a green table

This project uses the the first version of Google’s AIY Voice Kit, which comes with a larger black AIY Voice HAT and is compatible with Raspberry Pi 3 Model B. The kit also includes a little Voice HAT microphone board.

Version 2 of the kit comprises the smaller Raspberry Pi Zero WH and a slimmer ‘Voice Bonnet’.

The microphone allows Swear Bear to ‘hear’ your speech, and through its speakers it can then tell you off for swearing.

All of hardware is squeezed into the stuffing-free bear once the text-to-speech and profanity detection software is working.

Babbage Bear hack?

Babbage the Bear

8 Bits and a Byte fan Ben Scarboro took to the comments on YouTube to suggest they rework one of our Babbage Bears into a Swear Bear. Babbage is teeny tiny, so maybe you would need to fashion a giant version to accomplish this. Just don’t make us watch while you pull out its stuffing.

21 comments

Mike avatar

Inappropriate for a child friendly Pi project!
Facebook comments attracting bad language already.

Arya avatar

Umm….
Well, I dont use Facebook and IT might be a bit too much for children and its kinda embarrising.

Arya avatar

And I don’t know whether ‘potty-mouthed’ is exactly a good word. (pls dont get sad or embarrassed) Im just suggesting…

Arya avatar

K sorry got the meaning its not exactly a bad word but k fine…

Puffergas avatar

It would appear that the Raspberry stays cool enough, stuffed inside a bear. I guess it is idling most of the time.

Harry Hardjono avatar

It took me quite an effort to figure out who the maker is. I had to go to YouTube and check the About page. I will appreciate it if you credit the maker appropriately for these kind of projects.

Ashley Whittaker avatar

Credited twice!

8 Bits and a Byte avatar

Hey Harry,
Raspberry Pi are awesome peeps, and definitely one of the good ones. We feel very credited and flattered to be on the blog!

Harry Hardjono avatar

Good to know. For a while there, I thought Ben Scarboro was the creator, so I was misled. Then I noticed the word “fan” and decided to see who is really the creator. Turns out there’s two of you. So, I was rather disappointed that 2 good people aren’t named. But if it’s okay with you being credited as 8 bits and bytes, then it’s okay by me. Thank you for responding.

Michael Horne avatar

So… the first blog post of the New Year… just after the kids (hopefully) have got their brand new Raspberry Pis… and you choose a non-child friendly project which encourages children to launch swear words at Babbage to test it out. Featuring extensively a hardware kit that you can’t get any more? Ummmm…

Ashley Whittaker avatar

We’ve got a section of the website dedicated to projects for children: https://www.raspberrypi.org/learn/

We also worked on Christmas Day to get information out for people who received Raspberry Pi as a gift: https://www.raspberrypi.org/blog/merry-christmas-to-all-raspberry-pi-recipients-help-is-here/

8 Bits and a Byte avatar

Hi Michael,
Thanks for pointing that out, the project should also work perfectly on the V2 version of the AIY Kit.

Eric Olson avatar

Maybe it was the same way last year, I can’t remember, but this year I found it astonishing that there was a gap of 10 days between the start of Christmas and the next blog post. On account of the new Pi users, I would suggest queuing up a series of holiday articles that can run every day starting with December 26 next winter.

While the project of the current blog is not much to my taste, I think much of the negative response is due to expecting something really great after waiting 10 days.

Ashley Whittaker avatar

Not many volunteers to work every day between Christmas Eve and New Years to monitor the new blogs for comments. We still have to work through our holiday to do this but the workload is lessened by the lack of new content.

Anders avatar

I find it astonishing what some people will find to whinge about!

Connie Drake avatar

Great job on the Raspberry Pi kits. I can’t stand to hear people swear, so this bear will really come in handy. Thank you for making it.

CheezeBeard, The Lunchroom Pirate avatar

a fun and entertaining project to be sure, but i question the usefulness for households like mine who have a tendency to swear in multiple languages (6+ for myself, 3+ for my partner)
are there version for languages other than English or does the library include multi-lingual training?

8 Bits and a Byte avatar

Hi CheezeBeard,

First of all, love the username!
Secondly, they support quite a lot of languages, and have been adding more and more. For more information; the speech-to-text service used in the project is described here:
https://cloud.google.com/speech-to-text

Hope this answers your question somewhat :)
Again, congrats on the username!

CheezeBeard, The Lunchroom Pirate avatar

actually that is very helpful, thank you.
glad you like the name. i’ll let my partner know, since she’s the one who came up with it :)

John Anderson avatar

Many years ago, when I was working at IBM, a story made the rounds about a IBM test data generator program. A well-meaning manager asked if the program might generate swear words. If there were four character alphabetic fields, yes, it might, because data was generated randomly. That will never do for an IBM product replied the manager. Fix it. The development team said they would if the manager would send them a list of all the swear words that were not to appear. Nothing more was heard on the matter! :)

Martin Angove avatar

The elephant in the room – unless I have completely misunderstood the way these Google AI projects work – is that the “heavy lifting” is done on Google’s servers, not locally on the Pi. Your speech has to be sent over the internet to Google, which creates the textual response. Does this raises GDPR compliance issues, particularly where children are concerned? Yes, of course I note that this specific project isn’t exactly child-oriented!

Comments are closed