Select to view content in your preferred language

Counting Syllables in Survey123

278
1
07-30-2022 08:24 AM
KyleHicks
New Contributor

Hello Community! I have an idea for a Survey123 app that lets users write a Haiku and assign it to a location. In a Haiku, the first line has 5 syllables, the second 7, and the last another 5 syllables. 

Instead of just having an open text field for the Haiku, is there a way to use Python, or some other method, to count the syllables input into Survey123? I’m imagining a field for each of the three haiku lines, and the first field only accepts entries with exactly 5 syllables etc. I’m not attached to that idea but it’s the gist. Let the brainstorm begin! 

0 Kudos
1 Reply
ZacharySutherby
Esri Regular Contributor

Hello @KyleHicks

Python would be good for post processing the data it wouldn't be possible to have a Python script run while the user is filling out the form. 

If you would like real time validation in the form I would suggest using a custom JavaScript function to parse the text. Here are a few resources that can help getting started with counting the number of syllables in text using Javascript: 

https://stackoverflow.com/questions/5686483/how-to-compute-number-of-syllables-in-a-word-in-javascri...

https://www.codegrepper.com/code-examples/javascript/javascript+count+syllables

Thank you,
Zach
0 Kudos