Crate pqgrams

Crate pqgrams 

Source

Structs§

PQGram
A single ’gram in a profile.
Tree

Enums§

Node
A single tree node that may form part of a ’gram. PQGrams include filler labels for absent nodes in either dimension (usual notation is ‘’) so this enum lets the PQgram profile contain either while allowing literal ‘’ as a label.

Traits§

LabelledTree
Implement this for a tree to let it be PQGrammed.
ValidGramElement
ValidGramElement contains all the traits required of a PQGram member element. This approach DRYs up the code and keeps it tidy, but requires implementors to add an empty impl ValidGramElement for T {} block before impl’ing LabelledTree for the Tree container.

Functions§

flatten_profile
PQGrams are nested structures of ancestors and siblings, but their intended use is usually as flat vectors of constant length. This converts all PQGram elements in a profile into flat vectors.
pqgram_distance
Calculates PQGram distance between two profiles, using the default_gram_edit_distance function. All notes for pqgram_distance_with_fn apply here, particularly with respect to alt_filler_value!
pqgram_distance_with_fn
Given two sorted PQGram profiles, return a float value representing their distance, using the provided distance function to provide a 0..1 measure of similarity between PQGrams. If alt_filler_value is None, then the Default for type L is used to fill in Node::Filler elements in the PQGrams before ordering. When the Default for L is a value that also occurs in a valid tree (often the case!), you should provide an Value here that does not occur in the tree.
pqgram_profile
Build a PQGram vector profile