btree module¶
-
class
btree.KeyNode(key, value, doc_freq, term_freq)¶ Bases:
objectA keynode a structure that includes a term and the documents this term is found along with the frequency in each document and also tracks how many times this word was found.
-
get_value()¶ returns the document identifiers where this word was found. :return: set
-
idf(number_of_tokens)¶ returns the idf log(N/(1+frequency)) :param number_of_tokens: :return:
-
update(value, doc_freq, term_freq)¶ adds a document-article identifier and the frequency this word was found there. :param value: :param frequency: :return:
-
-
class
btree.KeyTree(parent=None)¶ Bases:
object-
add(key, value, doc_freq, term_freq)¶ adds a document to the token-tree, along with the document frequency and the term frequency. :param key: :param value: :param doc_freq: :param term_freq: :return:
-
delete_tr()¶ deletes the tree using the garbage collector :return:
-
find(key)¶ looks for a key-node. :param key: :return:
-
get_doc_count()¶ returns the count of tokens in a tree. :return:
-
traverse()¶
-
visualize_tree(key)¶
-