Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8387923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:20:57+00:00 2026-06-09T18:20:57+00:00

To be short: JAVA/Hibernate/AJAX/SpringMVC I would like that every comment which is posted by

  • 0

To be short:

JAVA/Hibernate/AJAX/SpringMVC

I would like that every comment which is posted by a user should be read on the server side before storing it into the database and reject the comment if it contains an offensive text.

The offensive text list is quite huge (maybe thousands). look at this example list: http://onlineslangdictionary.com/lists/most-vulgar-words/

I guess that iterating this list and execute a function like the following is not so fast. Is there any other way to do this filter more faster?
Do you think search over thousandths of items will have a big impact over resources CPU/RAM? Any suggestion is welcomed!

for(String offensiveText : offensiveTextList ){     
    if(commentText.contains(offensiveText )){
         //reject comment
    }
}

Update:
The offensive item list can contain items composed by a few words inside it (like a 3 words text, and can contain stop words).
It can contain even non alphabet characters like *&^%.

If the comment contains the respective offensive item (exactly same letters) then it is considered rejected

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:20:58+00:00Added an answer on June 9, 2026 at 6:20 pm

    You would probably need to use some natural language processing library for this. If you are going to compare every M word from a comment with N offensive words from a list, then your algorithm complexity is going to be O(MN) = O(N^2), which is quite high.

    Take a look at the Lucene stack, you may find some really good ideas, for example how to tokenize a comment and reduce the input by removing meaningless words.

    Also take a look at the thesis: “Distinguishing Between Factual Information and Insulting or Abusive Messages bearing Words or Phrases in News Articles”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short version: In pure Java EE 6, is there something like Spring's Authentication Processing
Is there any Java profiler that allows profiling short-lived applications? The profilers I found
First question here: it is a very short yet fundamental thing in Java that
I'm working on a java project full of Hibernate (3.3.1) mapping files that have
Given that byte,short and int are signed, why do byte and short in Java
I am using Java Date and Hibernate which is then being saved in the
I'm looking at this java web application that is using hibernate, jsp's, and spring
In Java, a byte or short is stored in the JVM's 'natural' word length,
I have a short question i have wrote this in java. Old code: class
The C code i need to convert into Java is: typedef struct { short

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.