content_indexer v0.2.5 ContentIndexer.TfIdf.DocCounts
Summary
DocCounts is a GenServer that contains a map of documents with their respective
total number of terms in the document
Link to this section Summary
Functions
If the document exists update the count, if it’s a new document add it and it’s respective term_count
Retrieves the current term_count for this document or nil if not in the 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_document(document_name, term_count)
If the document exists update the count, if it’s a new document add it and it’s respective term_count
## Example
iex> ContentIndexer.TfIdf.DocCounts.add_document("test_file_1.md", 23)
{:ok, {"test_file_1.md", 23}}
Link to this function
document_term_count(document_name)
Retrieves the current term_count for this document or nil if not in the map
## Example
iex> ContentIndexer.TfIdf.DocCounts.document_term_count("test_file_1.md")
{:ok, {"test_file_1.md", 23}}
Link to this function
reset()
Resets the document counts
## Example
iex> ContentIndexer.TfIdf.DocCounts.reset
{:ok, 0}
Link to this function
state()
Retrieves the current set of doc_counts i.e. the state
## Example
iex> ContentIndexer.TfIdf.DocCounts.state
{:ok, %{}}