To run the example project, clone the repo, and run pod install
from the Example directory first.
- iOS 16.0+
- Xcode 12.0+
- Swift 5.0+
pod 'SwiftyCorasick'
let package = Package(
name: "MyPackage",
dependencies: [
.package(url: "https://github.com/gomminjae/SwiftyCorasick.git")
],
targets: [
.target(name: "MyTarget", dependencies: ["SwiftyCorasick"])
]
)
To run the example project, clone the repo, and run pod install
from the Example directory first.
Below is a simple example of how to use SwiftyCorasick
to search for patterns in a given text.
import SwiftyCorasick
// Define patterns to search
let patterns = ["swift", "code", "corasick"]
let ac = SwiftyCorasick.shared
// Bind patterns to the trie
ac.bindKeywords(patterns)
// Text to search
let text = "swift and code with Aho-Corasick algorithm"
// Search for patterns in the text
ac.processTextAsync(text) { filteredText in
print("Filtered Text: \(filteredText)")
}
Filtered Text: "***** and **** with Aho-******** algorithm"
gomminjae, gommj0611@naver.com
SwiftyCorasick is available under the MIT license. See the LICENSE file for more info.