content_indexer v0.2.5 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
retrieves the document term count
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)
retrieves the document term count
## Example
iex> ContentIndexer.TfIdf.DocTerms.get_doc_term_count("test_file_1.md", "bread")
{:ok, 23}
Link to this function
reset()
Resets the document counts
## Example
iex> ContentIndexer.TfIdf.DocCounts.reset
{:ok, %{}}
Link to this function
state()
Retrieves the current set of doc_counts i.e. the state
## Example
iex> ContentIndexer.TfIdf.DocCounts.state
{:ok, 0}