Term frequency
Your task
Compute term frequencies for a tiny document. Given a document string, lowercase it and split on whitespace into tokens, then return a list of [term, frequency] pairs where frequency is the count of that term divided by the total number of tokens. Include each distinct term once, ordered alphabetically by term. If the document is empty or all-whitespace (zero tokens), return an empty list. Round each frequency to 4 decimal places.
Examples
term_frequency(doc: str) -> list[list]Example 1
Input
term_frequency("the cat the dog")Output
[["cat", 0.25], ["dog", 0.25], ["the", 0.5]]