util
module¶
- whoosh.util.make_binary_tree(fn, args, **kwargs)[source]¶
Takes a function/class that takes two positional arguments and a list of arguments and returns a binary tree of results/instances.
>>> make_binary_tree(UnionMatcher, [matcher1, matcher2, matcher3]) UnionMatcher(matcher1, UnionMatcher(matcher2, matcher3))
Any keyword arguments given to this function are passed to the class initializer.
- whoosh.util.make_weighted_tree(fn, ls, **kwargs)[source]¶
Takes a function/class that takes two positional arguments and a list of (weight, argument) tuples and returns a huffman-like weighted tree of results/instances.