-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 비속어 필터링 설정 #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
잘 구현했네요~~ 고생하셨습니다 👍 👍 💯 🥇 🎶🤣😊😒👌😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦄최😻고🎉현🍀예💌진👍
|
||
// ArrayList 대신 HashSet 사용하면 중복된 단어는 제외할 수 있음 | ||
badWords = new HashSet<>(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String[] enableList = new String[]{"똥"};
for (String s : enableList) {
badWordFiltering.remove(s);
}
이런식으로 관리하면 이미 등록되어 있는 필터링을 해제할 수 있습니다!
} | ||
|
||
public String badWordChange(String string) { | ||
String[] change = new String[]{"*"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 배열은 클래스 단에서 final로 관리하고
@Service
public class BadWordFilterService {
private final String[] symbols;
생성자에서 추가해준 뒤 (보통 아래처럼 다양한 문자열을 추가해주곤 합니다, 욕설 사이에 들어가도 잡아낼 String)
public BadWordFilterService() throws IOException {
symbols = new String[]{"!", "@", "#", "$", "%", "^", "&", "*", "_"};
public String badWordChange(String string) { | ||
String[] change = new String[]{"*"}; | ||
|
||
return badWordFiltering.change(string, change); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이후에 change 메서드를 호출할 때 아래와 같이 넘겨주는 것이 좋을 것 같습니다!
return badWordFiltering.change(string, �symbols);
src/main/resources/BadWord.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 txt파일 추가로 보내드릴테니 추가해주세요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유저 닉네임 설정에도 걸어줘야할 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
훌륭하네요 👍🏻👍🏻👍🏻
📌 관련 이슈
closed #59
✨ 어떤 이유로 변경된 내용인지
즉, BadWord.txt 파일에 비속어들을 업데이트 하면됩니당 !!!!!
🙏 검토 혹은 리뷰어에게 남기고 싶은 말