Charcoal, 1725 bytes
¬№﹪⌕A⭆S∨﹪Iι⁷χ0⁷¦⁵≔⭆S∨﹪Iι⁷χθ›⁼¹⁷Lθ№﹪⌕Aθ0⁷¦⁵
Try it online! Link is to verbose version of code. Outputs a Charcoal boolean i.e. -
for haiku, nothing if not. Works like my Retina answer, except it replaces 0
and 7
with 10
and checks that neither the 6th nor the 13th syllable is 0
. Explanation:
S Input string
⭆ Map over characters and join
ι Current character
I Cast to integer
﹪ ⁷ Reduce modulo 7
∨ χ Replace zeros with predefined variable 10
⌕A 0 Find all occurrences of literal string `0`≔⭆S∨﹪Iι⁷χθ
﹪ ⁷ Vectorised modulo 7
Reduce all of the digits modulo 7, then change all 0
s to 10
, so that 0
represents a second syllable.
›⁼¹⁷Lθ
¬№ ⁵ Check that there are no 5s.
Check that there are 17 syllables, but not that...
№﹪⌕Aθ0⁷¦⁵
any second syllables are at position equivalent to 5 (modulo 7).