content_indexer v0.2.4 ContentIndexer.TfIdf.TermCounts
Summary TermCounts is a GenServer that contains the numbers of documents that have a term ‘t’ Basically a map of all unique terms and their respective counts i.e. 1 per for each document that has this term
Link to this section Summary
Functions
If the term exists increment the count, if it’s a new term add and set count to 1
Initialises the Term Counts with an empty map
Resets the term counts
Retrieves the current set of term_counts i.e. the state
Link to this section Functions
Link to this function
increment_term(term)
If the term exists increment the count, if it’s a new term add and set count to 1
## Example
iex> ContentIndexer.TfIdf.TermCounts.increment_term("bread")
{:ok, {"bread", 3}}
Link to this function
init_term_counts()
Initialises the Term Counts with an empty map
Link to this function
reset()
Resets the term counts
## Example
iex> ContentIndexer.TfIdf.TermCounts.reset
{:ok, :reset}
Link to this function
start_link()
Link to this function
state()
Retrieves the current set of term_counts i.e. the state
## Example
iex> ContentIndexer.TfIdf.TermCounts.state
{:ok, 0}
Link to this function
term_count(term)