How Many Ways Can Things be Grouped Under Conditions Let's say we have a sentence:
"A man walked his dog to the park."
How many groups can be made with only words that are next to each other (general formula)?
To explain this:
"A"
is considered a group.
"A man"
is considered a group because the words are next to each other.
"A walked"
IS NOT a group because the words are not next to each other.
You can group as many words together as you like. All valid: "A man walked," "A man walked his dog to the park," "A man walked his," etc.
And you DO NOT have to start at A. All valid: "man walked," "walked his dog," "dog to the park," etc.
Ideally the formula would be expressed in n, where n represents the number of words.
EDIT:
"A man walked his dog to the park."
If we group under the conditions above, we'd have this brute force:
“A”
“A man”
“A man walked.”
“A man walked his”
“A man walked his dog”
“A man walked his dog to”
“A man walked his dog to the”
“A man walked his dog to the park.”
Those are all the possible groups starting at "A."
Starting at man we'd have:
“man”
“man walked.”
“man walked his”
“man walked his dog”
“man walked his dog to”
“man walked his dog to the”
“man walked his dog to the park.”
We'd then continue for the rest of the words.
Almost certain this would be expressed as SUM 0 to n where (n-k)

You can think to the problem by considering the point where you stop discarding words (can be $0$, if you start from “A”) and the point where you stop keeping words.
Thus it’s the same as taking two different numbers in $\{0,1,2,\dots,n\}$, where $n$ is the number of words in the sentence: the smaller number is “after this many words you start”, the larger is “this is the word you stop at”. Thus
$$
\binom{n+1}{2}=\frac{n(n+1)}{2}
$$
