func (wf *WordsFilter) Add(text string, root map[string]*Node) {
	if wf.StripSpace {
		text = stripSpace(text)
	}
	wf.mutex.Lock()
	defer wf.mutex.Unlock()
	wf.node.add(text, root, wf.Placeholder)
}
Add sensitive words to specified sensitive words Map.
package wordsfilter
import (
	"sync"
	"strings"
	"bytes"
	"os"
	"bufio"
	"io"
)
var DefaultPlaceholder = "*"
var DefaultStripSpace = true
type WordsFilter struct {
	Placeholder string
	StripSpace  bool
	node        *Node
	mutex       sync.RWMutex
}
func New() *WordsFilter {
	return &WordsFilter{
		Placeholder: DefaultPlaceholder,
		StripSpace:  DefaultStripSpace,
		node:        NewNode(make(map[string]*Node), ""),
	}
}
func (wf *WordsFilter) Generate(texts []string) map[string]*Node {
	root := make(map[string]*Node)
	for _, text := range texts {
		wf.Add(text, root)
	}
	return root
}
func (wf *WordsFilter) GenerateWithFile(path string) (map[string]*Node, error) {
	fd, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	defer fd.Close()
	buf := bufio.NewReader(fd)
	var texts []string
	for {
		line, _, err := buf.ReadLine()
		if err != nil {
			if err == io.EOF {
				break
			} else {
				return nil, err
			}
		}
		text := strings.TrimSpace(string(line))
		if text == "" {
			continue
		}
		texts = append(texts, text)
	}
	root := wf.Generate(texts)
	return root, nil
}