Word Frequency Counter
Easy
Given a string, write an Appian expression that counts the frequency of each word and returns each unique word along with the number of times it appears.
Example :
Input:
ri!s = "Appian is easy and Appian is powerful"
Output:
{
"appian - 2",
"is - 2",
"easy - 1",
"and - 1",
"powerful - 1"
}
ri! Rule Inputs
ri!sText"Appian is easy and Appian is powerful"
Example 1 — Case 1
Input: ri!s
"Hello, test string test"
Output:
{
"Hello - 1",
"test - 2",
"string - 1"
}Example 2 — Case 2
Input: ri!s
"apple, banana apple orange, banana, apple"
Output:
{
"apple - 3",
"banana - 2",
"orange - 1"
}Example 3 — Case 3
Input: ri!s
"Hello, hello TEST test String"
Output:
{
"hello - 2",
"test - 2",
"string - 1"
}Appian Expression Tips
- • Use
ri!variableNamefor rule inputs - • Use
a!localVariables(local!x: …, body)for locals - • Use
a!forEach(items: …, expression: fv!item)to iterate - • Use
where()/reject(fn!isnull, list)to filter