{"id":"text-count-words","version":"1.0.0","description":"Count words and return their code-point average, longest word, and optional capped per-word frequencies.","supported_operations":["how many words are in this passage","count each word in supplied prose","calculate average word length","find the longest whitespace delimited word","return word frequencies for this text","measure words using Unicode whitespace"],"unsupported_operations":["dictionary or linguistic word recognition","Unicode UAX #29 word segmentation","case-folded word frequency grouping"],"semantics":["Words are maximal non-empty runs of code points not having White_Space in Unicode 15.1.0 PropList.txt.","This is not Unicode Standard Annex #29 word segmentation.","Longest ties select the earliest word; average is a reduced numerator/denominator code-point fraction, or 0/1 when empty.","include_word_counts defaults to false; true returns first-occurrence-ordered exact-string frequencies and is limited to 256 distinct entries."],"limits":{"max_input_bytes":4096,"max_code_points":4096,"max_iterations":20480,"max_word_count_entries":256,"max_output_bytes":24576},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["text"],"properties":{"text":{"type":"string","maxLength":4096},"include_word_counts":{"type":"boolean","default":false}}},"output_schema":{"type":"object","additionalProperties":false,"required":["word_count","average_word_code_points","longest_word","longest_word_code_points","word_counts","standard_version","data_version"],"properties":{"word_count":{"type":"integer","minimum":0,"maximum":4096},"average_word_code_points":{"type":"string"},"longest_word":{"type":"string","maxLength":4096},"longest_word_code_points":{"type":"integer","minimum":0,"maximum":4096},"word_counts":{"oneOf":[{"type":"null"},{"type":"array","maxItems":256,"items":{"type":"object","additionalProperties":false,"required":["word","count"],"properties":{"word":{"type":"string","maxLength":4096},"count":{"type":"integer","minimum":1,"maximum":4096}}}}]},"standard_version":{"type":"string"},"data_version":{"type":"string"}}},"examples":[{"input":{"text":"one two"},"output":{"word_count":2,"average_word_code_points":"3/1","longest_word":"one","longest_word_code_points":3,"word_counts":null,"standard_version":"Unicode 15.1.0","data_version":"unicode-15.1.0-white-space"}},{"input":{"text":"red blue red","include_word_counts":true},"output":{"word_count":3,"average_word_code_points":"10/3","longest_word":"blue","longest_word_code_points":4,"word_counts":[{"word":"red","count":2},{"word":"blue","count":1}],"standard_version":"Unicode 15.1.0","data_version":"unicode-15.1.0-white-space"}}],"execute_url":"/v1/tools/text-count-words/versions/1.0.0/execute"}