{ "exercise": "word-count", "comments": [ "For each word in the input, count the number of times it appears in the", "entire sentence." ], "cases": [ { "uuid": "61559d5f-2cad-48fb-af53-d3973a9ee9ef", "description": "count one word", "property": "countWords", "input": { "sentence": "word" }, "expected": { "word": 1 } }, { "uuid": "5abd53a3-1aed-43a4-a15a-29f88c09cbbd", "description": "count one of each word", "property": "countWords", "input": { "sentence": "one of each" }, "expected": { "one": 1, "of": 1, "each": 1 } }, { "uuid": "2a3091e5-952e-4099-9fac-8f85d9655c0e", "description": "multiple occurrences of a word", "property": "countWords", "input": { "sentence": "one fish two fish red fish blue fish" }, "expected": { "one": 1, "fish": 4, "two": 1, "red": 1, "blue": 1 } }, { "uuid": "e81877ae-d4da-4af4-931c-d923cd621ca6", "description": "handles cramped lists", "property": "countWords", "input": { "sentence": "one,two,three" }, "expected": { "one": 1, "two": 1, "three": 1 } }, { "uuid": "7349f682-9707-47c0-a9af-be56e1e7ff30", "description": "handles expanded lists", "property": "countWords", "input": { "sentence": "one,\ntwo,\nthree" }, "expected": { "one": 1, "two": 1, "three": 1 } }, { "uuid": "a514a0f2-8589-4279-8892-887f76a14c82", "description": "ignore punctuation", "property": "countWords", "input": { "sentence": "car: carpet as java: javascript!!&@$%^&" }, "expected": { "car": 1, "carpet": 1, "as": 1, "java": 1, "javascript": 1 } }, { "uuid": "d2e5cee6-d2ec-497b-bdc9-3ebe092ce55e", "description": "include numbers", "property": "countWords", "input": { "sentence": "testing, 1, 2 testing" }, "expected": { "testing": 2, "1": 1, "2": 1 } }, { "uuid": "dac6bc6a-21ae-4954-945d-d7f716392dbf", "description": "normalize case", "property": "countWords", "input": { "sentence": "go Go GO Stop stop" }, "expected": { "go": 3, "stop": 2 } }, { "uuid": "4185a902-bdb0-4074-864c-f416e42a0f19", "description": "with apostrophes", "property": "countWords", "input": { "sentence": "First: don't laugh. Then: don't cry." }, "expected": { "first": 1, "don't": 2, "laugh": 1, "then": 1, "cry": 1 } }, { "uuid": "4ff6c7d7-fcfc-43ef-b8e7-34ff1837a2d3", "reimplements": "4185a902-bdb0-4074-864c-f416e42a0f19", "description": "with apostrophes", "comments": ["Added a word with multiple letters after apostrophe"], "property": "countWords", "input": { "sentence": "'First: don't laugh. Then: don't cry. You're getting it.'" }, "expected": { "first": 1, "don't": 2, "laugh": 1, "then": 1, "cry": 1, "you're": 1, "getting": 1, "it": 1 } }, { "uuid": "be72af2b-8afe-4337-b151-b297202e4a7b", "description": "with quotations", "property": "countWords", "input": { "sentence": "Joe can't tell between 'large' and large." }, "expected": { "joe": 1, "can't": 1, "tell": 1, "between": 1, "large": 2, "and": 1 } }, { "uuid": "8d6815fe-8a51-4a65-96f9-2fb3f6dc6ed6", "description": "substrings from the beginning", "property": "countWords", "input": { "sentence": "Joe can't tell between app, apple and a." }, "expected": { "joe": 1, "can't": 1, "tell": 1, "between": 1, "app": 1, "apple": 1, "and": 1, "a": 1 } }, { "uuid": "c5f4ef26-f3f7-4725-b314-855c04fb4c13", "description": "multiple spaces not detected as a word", "property": "countWords", "input": { "sentence": " multiple whitespaces" }, "expected": { "multiple": 1, "whitespaces": 1 } }, { "uuid": "50176e8a-fe8e-4f4c-b6b6-aa9cf8f20360", "description": "alternating word separators not detected as a word", "property": "countWords", "input": { "sentence": ",\n,one,\n ,two \n 'three'" }, "expected": { "one": 1, "two": 1, "three": 1 } }, { "uuid": "6d00f1db-901c-4bec-9829-d20eb3044557", "description": "quotation for word with apostrophe", "property": "countWords", "input": { "sentence": "can, can't, 'can't'" }, "expected": { "can": 1, "can't": 2 } } ] }