Skip to content

Efficient bad word filtering using AhoCorasick and n-gram 💥

License

Notifications You must be signed in to change notification settings

gomminjae/SwiftyCorasick

Repository files navigation

SwiftyCorasick

Version License Platform Swift Tests

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 16.0+
  • Xcode 12.0+
  • Swift 5.0+

Installation

Podfile

pod 'SwiftyCorasick'

Package.swift

let package = Package(
  name: "SwiftCorasick",
  dependencies: [
    .package(url: "https://github.com/gomminjae/SwiftyCorasick.git")
  ],
  targets: [
    .target(name: "MyTarget", dependencies: ["SwiftyCorasick"])
  ]
)

📖 Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Basic Example

Below is a simple example of how to use SwiftyCorasick to search for patterns in a given text.

import SwiftyCorasick

Task {
    // 비동기 함수 호출
    let maskedText = await SwiftyCorasick.shared.processTextAsync(testText)
    // 결과 처리
    print("Masked Text: \(maskedText)")
}

Output

Filtered Text: "***** and **** with Aho-******** algorithm"

Author

gomminjae, [email protected]

License

SwiftyCorasick is available under the MIT license. See the LICENSE file for more info.

About

Efficient bad word filtering using AhoCorasick and n-gram 💥

Resources

License

Stars

Watchers

Forks

Packages

No packages published