Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/titsuki/raku-algorithm-ahocorasick
A Raku Aho-Corasick dictionary matching algorithm implementation
https://github.com/titsuki/raku-algorithm-ahocorasick
aho-corasick perl6 raku rakulang
Last synced: 3 months ago
JSON representation
A Raku Aho-Corasick dictionary matching algorithm implementation
- Host: GitHub
- URL: https://github.com/titsuki/raku-algorithm-ahocorasick
- Owner: titsuki
- License: artistic-2.0
- Created: 2016-01-23T10:39:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T05:27:37.000Z (over 4 years ago)
- Last Synced: 2024-10-10T21:40:15.487Z (3 months ago)
- Topics: aho-corasick, perl6, raku, rakulang
- Language: Raku
- Homepage:
- Size: 44.9 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/titsuki/raku-Algorithm-AhoCorasick.svg?branch=master)](https://travis-ci.org/titsuki/raku-Algorithm-AhoCorasick)
NAME
====Algorithm::AhoCorasick - A Raku Aho-Corasick dictionary matching algorithm implementation
SYNOPSIS
========use Algorithm::AhoCorasick;
my Algorithm::AhoCorasick $aho-corasick .= new(keywords => ['corasick','sick','algorithm','happy']);
my $matched = $aho-corasick.match('aho-corasick was invented in 1975'); # set("corasick","sick")
my $located = $aho-corasick.locate('aho-corasick was invented in 1975'); # {"corasick" => [4], "sick" => [8]}DESCRIPTION
===========Algorithm::AhoCorasick is a implmentation of the Aho-Corasick algorithm (1975). It constructs the finite state machine from a list of keywords offline. By the finite state machine, it can find the keywords within an input text online.
CONSTRUCTOR
-----------### new
my Algorithm::AhoCorasick $aho-corasick .= new(keywords => @keyword-list);
Constructs a new finite state machine from a list of keywords.
METHODS
-------### match
my $matched = $aho-corasick.match($text);
Returns elements of a finite set of strings within an input text.
### locate
my $located = $aho-corasick.locate($text);
Returns elements of a finite set of strings within an input text where each string contains the locations in which it appeared.
AUTHOR
======titsuki
COPYRIGHT AND LICENSE
=====================Copyright 2016 titsuki
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
The algorithm is from Alfred V. Aho and Margaret J. Corasick, Efficient string matching: an aid to bibliographic search, CACM, 18(6):333-340, June 1975.