是否可以使用Java过滤不良语言的单词? [英] Is it possible to filter bad language words using Java?

查看:63
本文介绍了是否可以使用Java过滤不良语言的单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以过滤不良语言的单词.过滤亵渎行为的一个示例是用户创建帐户时的用户名,这样它可以通知用户该词是不可接受的.

I was wondering if it's possible to filter bad language words. An example of filtering profanity is a username when they create an account so it can inform users that this word is unacceptable.

有可能吗?谢谢:)

推荐答案

否,不可能使用任何编程语言来过滤不良语言单词.

No, it's not possible to filter bad language words using any programming language.

您能做的最好的事情是创建一个不良语言单词列表,然后对照该列表进行检查.只要系统存在,您就将单词添加到列表中.

The best you can do is create a List of bad language words, and check against the List. You will be adding words to the List for as long as your system exists.

这是一个简单的示例来说明问题.假设地狱"是一个不好的语言单词.这是地狱"的一些变体.

Here's a simple example to illustrate the problem. Let's assume "hell" is a bad language word. Here are some of the variations of "hell".

h e l l
h e 1 l (one, l)
h e l 1 (l, one)
he1l
hel1
he11
he ll
etc.

那是一个字.想象一下,您的用户将为所有不良语言单词的变体带来多大的乐趣.

And that's one word. Imagine how much fun your users will have coming up with variations to all of the bad language words.

这篇关于是否可以使用Java过滤不良语言的单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆