korcen

package module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

README ΒΆ

Korcen.go

Go Version Module Version

KR / EN

131_20220604170616

πŸ›  μ œμž‘μž

Tanat05 / korcen

https://github.com/Tanat05/korcen
---------------------------------
이 ν”„λ‘œμ νŠΈλŠ” 원본 `korcen` ν”„λ‘œμ νŠΈλ₯Ό μˆ˜μ •ν•˜μ—¬ λ°°ν¬ν•œ κ²ƒμž…λ‹ˆλ‹€.
원본 ν”„λ‘œμ νŠΈλŠ” `https://github.com/Tanat05/korcen`μ—μ„œ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.

이 ν”„λ‘œμ νŠΈμ˜ λΌμ΄μ„ΌμŠ€ λ˜ν•œ Apache-2.0 을 λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€

gyarang / gohangul

https://github.com/gyarang/gohangul
-----------------------------------
이 ν”„λ‘œμ νŠΈλŠ” `gohangul` 을 μ‚¬μš©ν•΄μ„œ λ°°ν¬ν•œ κ²ƒμž…λ‹ˆλ‹€.
ν•΄λ‹Ή ν”„λ‘œμ νŠΈλŠ” `https://github.com/gyarang/gohangul`μ—μ„œ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.

ν•΄λ‹Ή ν”„λ‘œμ νŠΈμ˜ λΌμ΄μ„ΌμŠ€μΈ MIT License λ˜ν•œ λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€

Apache-2.0

korcen-goλŠ” Apache-2.0 & MIT License λΌμ΄μ„ μŠ€λ₯Ό λͺ¨λ‘ λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€. μ½”λ“œλ₯Ό μ‚¬μš©ν•  경우 λΌμ΄μ„ μŠ€ λ‚΄μš©μ„ μ€€μˆ˜ν•΄μ£Όμ„Έμš”.

CopyrightΒ© All rights reserved.


❓ μ£Όμš” κΈ°λŠ₯

[λΆ€μ μ ˆν•œ μ–Έμ–΄ 감지]
- 일반적인 λΆ€μ μ ˆν•œ μ–Έμ–΄
- κ²½λ―Έν•œ λΆ€μ μ ˆν•œ μ–Έμ–΄
- 성적 μ–Έμ–΄λ‚˜ ν‘œν˜„
- λΉ„ν•˜ν•˜λŠ” ν‘œν˜„
- 인쒅 차별적인 λΆ€μ μ ˆν•œ ν‘œν˜„
- λΆ€λͺ¨λ₯Ό λΉ„ν•˜ν•˜κ±°λ‚˜ κ³΅κ²©ν•˜λŠ” μ–Έμ–΄
- μ •μΉ˜μ  λΆ€μ μ ˆν•œ μ–Έμ–΄λ‚˜ ν‘œν˜„
- μ˜μ–΄μ—μ„œ λΆ€μ μ ˆν•œ ν‘œν˜„
- μΌλ³Έμ—μ„œ λΆ€μ μ ˆν•œ ν‘œν˜„
- μ€‘κ΅­μ—μ„œ λΆ€μ μ ˆν•œ ν‘œν˜„
- 기타 νŠΉμˆ˜ν•œ λΆ€μ μ ˆν•œ ν‘œν˜„

⬇️ μ„€μΉ˜ 방법

mod

$ go get github.com/fluffy-melli/korcen-go
L v0.7.0 버전 μ΄ν›„λ‘œ ν•¨μˆ˜ 좜λ ₯이 λ‹¬λΌμ‘ŒμœΌλ―€λ‘œ μ‚¬μš©μ‹œμ— μœ μ˜ν•΄μ£Όμ‹œκΈ° λ°”λžλ‹ˆλ‹€

golang μ½”λ“œ 예제

package main

import (
	"fmt"

	"github.com/fluffy-melli/korcen-go"
)

func main() {
	// Discord Message Event Logic
	ck := korcen.Check("MESSAGE")
	if ck.Detect {
		dtif := ck.Swear[0]
		message := ck.NewText[:dtif.Start] + "\x1b[1m\x1b[41m\"" + ck.NewText[dtif.Start:dtif.End] + "\"\x1b[0m" + ck.NewText[dtif.End:]
		discord_ansi := "```ansi\n" + message + "\n```"
		fmt.Println(discord_ansi)
	}
	// Discord Send Logic
}

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

View Source
const (
	DNone int = iota
	DGeneral
	DMinor
	DSexual
	DBelittle
	DRace
	DParent
	DPolitics
	DEnglish
	DJapanese
	DChinese
	DSpecial
)

λΉ„μ†μ–΄μ˜ μœ ν˜•

Variables ΒΆ

This section is empty.

Functions ΒΆ

func After ΒΆ added in v0.6.1

func After(input string) string

func ChangeUnicode ΒΆ

func ChangeUnicode(unicode string) string

func EnglishToKo ΒΆ added in v0.7.3

func EnglishToKo(input string) string

func KoToEnglish ΒΆ added in v0.8.4

func KoToEnglish(input string) string

func PreBelittle ΒΆ added in v0.7.3

func PreBelittle(input string) string

func PreGeneral ΒΆ added in v0.7.3

func PreGeneral(input string) string

func PreMinor ΒΆ added in v0.7.3

func PreMinor(input string) string

func PreParent ΒΆ added in v0.7.3

func PreParent(input string) string

func PrePolitics ΒΆ added in v0.7.3

func PrePolitics(input string) string

func PreSexual ΒΆ added in v0.7.3

func PreSexual(input string) string

func RemoveDomain ΒΆ added in v0.8.1

func RemoveDomain(input string) string

func RemoveDuplicate ΒΆ added in v0.7.3

func RemoveDuplicate(input string) string

func RemoveEnglish ΒΆ added in v0.8.3

func RemoveEnglish(input string) string

func RemoveJ ΒΆ added in v0.7.3

func RemoveJ(input string) string

func RemoveNumber ΒΆ added in v0.7.3

func RemoveNumber(input string) string

Types ΒΆ

type CheckInfo ΒΆ

type CheckInfo struct {
	Detect  bool      // 비속어 감지 μ—¬λΆ€
	NewText string    // μž…λ ₯된 λ©”μ‹œμ§€
	Swear   []IndexOF // κ°μ§€λœ 비속어
}

func Check ΒΆ

func Check(input string) *CheckInfo

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

 *CheckInfo: struct {
	    Detect bool   // 비속어 감지 μ—¬λΆ€
		Swear  string // κ°μ§€λœ 비속어
		Type   int    // λΉ„μ†μ–΄μ˜ μœ ν˜•
 }

type IndexOF ΒΆ added in v0.7.0

type IndexOF struct {
	Swear string // κ°μ§€λœ 비속어
	Type  int    // κ°μ§€λœ λΉ„μ†μ–΄μ˜ μœ ν˜•
	Start int    // μ‹œμž‘μœ„μΉ˜
	End   int    // μ’…λ£Œμœ„μΉ˜
}

func Belittle ΒΆ

func Belittle(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ λΉ„ν•˜λ°œμ–Έκ΄€λ ¨ 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func CList ΒΆ added in v0.7.2

func CList(list *[]string, types int, input string, continues bool) (bool, []IndexOF)

func Chinese ΒΆ

func Chinese(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 쀑ꡭ어관련 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func English ΒΆ

func English(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ μ˜μ–΄κ΄€λ ¨ 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func General ΒΆ

func General(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 일반적인 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func Japanese ΒΆ

func Japanese(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 일본어관련 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func Minor ΒΆ

func Minor(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ μ‚¬μ†Œν•œ 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func Parent ΒΆ

func Parent(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ νŒ¨λ“œλ¦½κ΄€λ ¨ 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func Politics ΒΆ

func Politics(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ μ •μΉ˜κ΄€λ ¨ 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func Race ΒΆ

func Race(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 인쒅차별관련 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func Sexual ΒΆ

func Sexual(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 성적관련 비속어 감지 및 κ²°κ³Ό λ°˜ν™˜ ν•¨μˆ˜ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

func Special ΒΆ

func Special(input string, continues bool) (bool, []IndexOF)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ μž…λ ₯:

input: 비속어가 포함될 수 μžˆλŠ” λ¬Έμžμ—΄.

좜λ ₯:

bool: 비속어가 ν¬ν•¨λœ 경우 true, 그렇지 μ•ŠμœΌλ©΄ false.
string: κ°μ§€λœ 비속어가 있으면 ν•΄λ‹Ή 비속어λ₯Ό, μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜.

type Profanity ΒΆ

type Profanity struct {
	CensorWords     map[string]bool
	CharMapping     map[rune][]rune
	AllowedChars    map[rune]bool
	MaxCombinations int
}

func NewProfanity ΒΆ

func NewProfanity(words *[]string) *Profanity

func (*Profanity) Censor ΒΆ

func (p *Profanity) Censor(text string) (bool, string)

func (*Profanity) ContainsProfanity ΒΆ

func (p *Profanity) ContainsProfanity(word string) bool

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL