Number of syllables | WordPress.org

[ad_1]

Hello @fibbu

Counting syllables is very complex because it depends on the text languages and their grammatical rules. The plugin does not include an operation to calculate syllables, but you can enter your own operations in the equations.

For example, assuming you have the text field fieldname1, you can insert a calculated field in the form and enter the following piece of code as its equation:


(function(){
function new_count(word) {
    if (word.length === 0) return 0;
    word = word.toLowerCase();
    if (word.length <= 3) return 1;
    word = word.replace(' ', '&#13').replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/, '').replace(/^y/, '');
    return word.match(/[aeiouy]{1,2}/g).length;
};

return new_count(fieldname1|r);
})()

We borrowed the new_count operation code from the web page.

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer