Documentation ¶
Index ¶
- type Node
- func (n *Node) AddChild(c *Node)
- func (n *Node) AddSynonym(ss ...string)
- func (n *Node) AddTreeNumber(tn ...string)
- func (n *Node) Categories() set.Set
- func (n *Node) Leafs() int
- func (n *Node) Name() string
- func (n *Node) Size(i, l int) int
- func (n *Node) Synonyms() set.Set
- func (n *Node) TreeNumbers() set.Set
- func (n *Node) Update(m *Node) bool
- type Nodes
- type Normalizer
- type Priority
- type Taxonomy
- func (t *Taxonomy) AddNode(n *Node) bool
- func (t *Taxonomy) AddNodes(ns Nodes) int
- func (t *Taxonomy) Candidates(s string) []int
- func (t *Taxonomy) Info()
- func (t *Taxonomy) Match(s string, d float64, filter set.Set) Terms
- func (t *Taxonomy) MatchNode(n *Node, d float64, filter set.Set) Terms
- func (t *Taxonomy) Normalize(f Normalizer)
- func (t *Taxonomy) SetBaseIndex()
- func (t *Taxonomy) SetBuffSize(b int)
- func (t *Taxonomy) SetHashIndex(rows, bands int)
- func (t *Taxonomy) SetMinScore(p float64)
- func (t *Taxonomy) SetQueueCapacity(c int)
- func (t *Taxonomy) Store(fname, sep string) error
- type Term
- type Terms
- func (ts Terms) Categories() []string
- func (ts Terms) Dedupe() Terms
- func (ts Terms) Keys() []string
- func (ts Terms) Len() int
- func (ts Terms) MaxKey() string
- func (ts Terms) MaxValue() float64
- func (ts Terms) Normalized() string
- func (ts Terms) PassFilter(categories set.Set) Terms
- func (ts Terms) SortByKey() Terms
- func (ts Terms) SortByValue() Terms
- func (ts Terms) String() string
- func (ts Terms) TopDelta(d float64) Terms
- func (ts Terms) TreeNumbers() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node defines a node in a taxonomy.
func (*Node) AddSynonym ¶
AddSynonym add a slice of synonyms to the node.
func (*Node) AddTreeNumber ¶
AddTreeNumber add a slice of tree numbers to the node.
func (*Node) Categories ¶
Categories returns all categories of the node and its child nodes.
func (*Node) TreeNumbers ¶
TreeNumbers returns all tree numbers of the node and its child nodes.
type Normalizer ¶
Normalizer defines a normalizer function to normalize node synonyms.
type Priority ¶
type Priority struct {
// contains filtered or unexported fields
}
Priority defines a priority queue.
type Taxonomy ¶
type Taxonomy struct {
// contains filtered or unexported fields
}
Taxonomy defines a taxonomy for a vocabulary.
func (*Taxonomy) AddNode ¶
AddNode adds a node to the taxonomy. Nodes with the same name are joined.
func (*Taxonomy) AddNodes ¶
AddNodes adds nodes to the taxonomy. Nodes with the same name are joined.
func (*Taxonomy) Candidates ¶
Candidates finds a set of candidate nodes for given string.
func (*Taxonomy) Normalize ¶
func (t *Taxonomy) Normalize(f Normalizer)
Normalize normalizes the node synonyms.
func (*Taxonomy) SetBaseIndex ¶
func (t *Taxonomy) SetBaseIndex()
SetBaseIndex sets the index to a slice.
func (*Taxonomy) SetBuffSize ¶
SetBuffSize sets the buffer size of the search channel.
func (*Taxonomy) SetHashIndex ¶
SetHashIndex sets the indexing to LSH.
func (*Taxonomy) SetMinScore ¶
SetMinScore sets the minimum score below which terms are disregarded.
func (*Taxonomy) SetQueueCapacity ¶
SetQueueCapacity sets the capacity of the search priority queue.
type Term ¶
type Term struct { Key string Normalized string Value float64 Categories set.Set TreeNumbers set.Set }
Term defines a vocabulary term or concept with a Key (e.g., name) and Value (e.g., score).
func (Term) PassFilter ¶
PassFilter returns true if any of the terms categories are in filter.
type Terms ¶
type Terms []Term
Terms define a slice of terms.
func (Terms) Categories ¶
Categories returns the unique categories of the terms.
func (Terms) Dedupe ¶
Dedupe de-duplicates terms by their keys. Categories and tree numbers of duplicate terms are joined.
func (Terms) MaxKey ¶
MaxKey returns the key of the term with the largest value. Terms are assumed to be sorted in reverse order by Value.
func (Terms) MaxValue ¶
MaxValue returns the largest value. Terms are assumed to be sorted in reverse order by Value.
func (Terms) Normalized ¶
Normalized returns the normalized key.
func (Terms) PassFilter ¶
PassFilter keeps terms whose categories are in categories filter.
func (Terms) SortByValue ¶
SortByValue sorts terms by value in reverse order.
func (Terms) TreeNumbers ¶
TreeNumbers returns the unique tree numbers of the terms.