bf25_pycounts.bf25_pycounts =========================== .. py:module:: bf25_pycounts.bf25_pycounts Functions --------- .. autoapisummary:: bf25_pycounts.bf25_pycounts.load_text bf25_pycounts.bf25_pycounts.clean_text bf25_pycounts.bf25_pycounts.count_words Module Contents --------------- .. py:function:: load_text(input_file) Load text from a text file and return as a string. :param input_file: Path to text file. :type input_file: str :returns: Text file contents. :rtype: str .. rubric:: Examples >>> load_text("text.txt") .. py:function:: clean_text(text) Lowercase and remove punctuation from a string. :param text: Text to clean. :type text: str :returns: Cleaned text. :rtype: str .. rubric:: Examples >>> clean_text("Early optimization is the root of all evil!") 'early optimization is the root of all evil' .. py:function:: count_words(input_file) Count words in a text file. Words are made lowercase and punctuation is removed before counting. :param input_file: Path to text file. :type input_file: str :returns: dict-like object where keys are words and values are counts. :rtype: collections.Counter .. rubric:: Examples >>> count_words("text.txt")