Skip to content
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

Merged
merged 4 commits into from
Jan 16, 2024

Conversation

eeddiinn
Copy link
Contributor

@eeddiinn eeddiinn commented Jan 16, 2024

📌 관련 이슈

closed #59

✨ 어떤 이유로 변경된 내용인지

  • 비속어 필터링을 설정하였습니다.
  • BadWordFiltering 라이브러리를 활용하였습니다.
  • BadWords에 새로운 비속어들을 바로 업데이트 할 수 있는줄 알았는데 안되어서 BadWord.txt 파일을 읽어와 비속어 목록에 추가 할 수 있도록 하였습니다.
    즉, BadWord.txt 파일에 비속어들을 업데이트 하면됩니당 !!!!!

🙏 검토 혹은 리뷰어에게 남기고 싶은 말

  • 휴우 🤤

@eeddiinn eeddiinn added ✨Feat 새로운 기능 추가 예진❄️ 🔥 Pull Request PR 날림 labels Jan 16, 2024
@eeddiinn eeddiinn self-assigned this Jan 16, 2024
@eeddiinn eeddiinn changed the title Feat/#59 badword filtering setting [FEAT] 비속어 필터링 설정 Jan 16, 2024
Copy link
Contributor

@dong2ast dong2ast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 구현했네요~~ 고생하셨습니다 👍 👍 💯 🥇 🎶🤣😊😒👌😁

Copy link
Member

@ddongseop ddongseop left a 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<>();

Copy link
Member

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[]{"*"};
Copy link
Member

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);
Copy link
Member

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);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 txt파일 추가로 보내드릴테니 추가해주세요!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유저 닉네임 설정에도 걸어줘야할 것 같습니다!

@eeddiinn eeddiinn merged commit 8fd5e51 into develop Jan 16, 2024
1 check passed
@eeddiinn eeddiinn deleted the feat/#59-badword_filtering_setting branch January 16, 2024 15:15
Copy link
Member

@jungwoo3490 jungwoo3490 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

훌륭하네요 👍🏻👍🏻👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨Feat 새로운 기능 추가 예진❄️ 🔥 Pull Request PR 날림
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] 비속어 필터링 설정
4 participants