content_indexer v0.2.4 ContentIndexer.TfIdf.DocTerms

Summary DocTerms is a GenServer with a Map of tuples that has the document, and a count of each of the terms in the document

The key is a combination of the document_name & term

Link to this section Summary

Functions

If the document exists update the term and count, if it’s a new document add it and it’s respective term & term_count

Initialises the Doc Terms with an empty map

Resets the document counts

Retrieves the current set of doc_counts i.e. the state

Link to this section Functions

Link to this function add_doc_term_count(document_name, term, count)

If the document exists update the term and count, if it’s a new document add it and it’s respective term & term_count

## Example

iex> ContentIndexer.TfIdf.DocTerms.add_doc_term_count("test_file_1.md", "bread", 23)
{:ok, {"test_file_1.md", "bread, 23}}
Link to this function get_doc_term_count(document_name, term)
Link to this function init_doc_terms()

Initialises the Doc Terms with an empty map

Resets the document counts

## Example

iex> ContentIndexer.TfIdf.DocCounts.reset
{:ok, 0}

Retrieves the current set of doc_counts i.e. the state

## Example

iex> ContentIndexer.TfIdf.DocCounts.state
{:ok, 0}