Skip to content

webtor-io/stoplist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stoplist

Generates stoplist from YAML-format

Supports:

  1. Regexp patterns
  2. AND/OR conditions
  3. References

Installation

go get 'github.com/webtor-io/stoplist'

Sample usage

package main

import (
	"log"
	"github.com/webtor-io/stoplist"
)

var rules = `
main:
- abra
- cadabra
`

func main() error {
    r, err := stoplist.NewRuleFromYaml([]byte(rules))
    if err != nil {
        return err
    }
    res := r.Check("abra cadabra")
    log.Println(res)
    return nil
}

Rules

  1. YAML must have main key - it is starting point
  2. Every key must have an array of rules and all these rules will be used with OR condition, like:
main:
- rule1
- rule2
- ...
  1. All keys can be referenced with curly brackets, like:
rule:
- something
main:
- {rule}
  1. Regular expression must be enclosed with slashes, like:
main:
- /\d+/
  1. OR condition is represented with pipe |, like:
main:
- aaa|bbb|ccc
  1. AND condition is represented with plus +, like:
main:
- aaa+bbb+ccc

About

Generates stoplist from YAML format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages