I'd love to take a number and know how many syllables are in it, when spoken in English.
Let's limit this to positive integers which are less than one thousand.
I'm British, so we're going to follow the hundreds column with an 'and' when there are any non-zero digits after it.
The Challenge
- Write some code which will accept a positive integer lower than 1000 and output the number of syllables in the words which represent that number in British English.
- It DOES NOT need to generate the words to represent the numbers, only the number of syllables they contain.
- It's code golf, attempt to achieve this in the fewest bytes.
- Use any language you like.
- The standard loopholes are forbidden.
Test Cases
| N | In words | Syllables |
| 1 | one | 1 |
| 2 | two | 1 |
| 3 | three | 1 |
| 4 | four | 1 |
| 5 | five | 1 |
| 6 | six | 1 |
| 7 | sev-en | 2 |
| 8 | eight | 1 |
| 9 | nine | 1 |
| 10 | ten | 1 |
| 11 | el-ev-en | 3 |
| 12 | twelve | 1 |
| 13 | thir-teen | 2 |
| 14 | four-teen | 2 |
| 17 | se-ven-teen | 3 |
| 20 | twen-ty | 2 |
| 21 | twen-ty one | 3 |
| 42 | four-ty two | 3 |
| 73 | sev-en-ty three | 4 |
| 77 | sev-en-ty sev-en | 5 |
| 100 | one hund-red | 3 |
| 110 | one hund-red and ten | 5 |
| 111 | one hund-red and el-ev-en | 7 |
| 555 | five hund-red and fif-ty five | 7 |
| 700 | sev-en hund-red | 4 |
| 770 | sev-en hund-red and sev-en-ty | 8 |
| 777 | sev-en hund-red and sev-en-ty sev-en | 10 |
| 999 | nine hund-red and nine-ty nine | 7 |