This function assumes it's being passed a vowel cluster and return true iff the cluster typically has more than one syllable. - Java java.lang

Java examples for java.lang:char

Description

This function assumes it's being passed a vowel cluster and return true iff the cluster typically has more than one syllable.

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        String cluster = "java2s.com";
        System.out.println(isMultisyllableVowelCluster(cluster));
    }/*from ww  w.ja v  a2  s.  co m*/

    /**
     *
     * This function assumes it's being passed a vowel cluster
     * and return true iff the cluster typically has more than one
     * syllable. This is impossible to get perfect with such simple
     * code i.e. the "io" in caution vs. cation.
     *
     * @param cluster
     * @return
     */
    static boolean isMultisyllableVowelCluster(String cluster) {
        if (cluster.length() > 2) {
            return true;
        } else if (cluster.equals("eo") || cluster.equals("ia")
                || cluster.equals("io") || cluster.equals("ua")
                || cluster.equals("uo")) {
            return true;
        }
        return false;
    }
}

Related Tutorials