guys please help! im having trouble splitting a word into syllables. what i have so far is splitting a word into different compartment bt cant do syllables, i want the code to to be able slice a part of a word,by looking, vowels INSIDE the word!at the end of each vowel, it should slice e.g given word "code" OUTPUT should be "co" ,"de". if itsa setswana word like "motho"(which means a person), i should get output like "mo" and "tho"
this is what i have so far

public void splitter(String word)

ArrayList<String> list = new ArrayList<String>();
for (int i = 1; i <= 3; i++) {
int limit = word.length() - i + 1;
for (int j = 0; j < limit; j++) {
list.add(word.substring(j, j+i));
2 Years
Discussion Span
Last Post by sekwamote
Featured Replies
  • 1

    duplicate of https://www.daniweb.com/software-development/java/threads/485453/separating-a-word-into-syllables Read More


Before you go too far with that solution I feel I should point out that splitting after a vowel won't always give you correct syllables. For example, you used CODE, saying the result should be "co" and "de" but code is a monosyllable word.
As is TOW, DAWN, RACE and a lot of other words that won't fit your algorithm. Splitting accurately by syllable is a lot more complicated than splitting after a vowel.


i understand with english! bt my example was only in reference with my native language as is the project im am trying to code! im doing a program that can separate syllables in SETSWANA LANGUAGE! and in setswana its very much like that


Then I stand corrected (and learnt something).
One solution would be to build up an array of the vowels and then progress through the word checking each letter. If it exists in the vowel array you split at that point and continue going until you hit the end.


i tried to do using split method bt! doesnt work for words like "kamoso" which should be "ka" "mo" "so" bt its different

 public void syllable(String word)
    int i=0;
     int z=0;
   for (i=i;i<word.length()-1; i++){
    char w = word.charAt(i);
     String w1=Character.toString(w);
   if(w=='a'|| w=='e' || w=='i' || w=='o' || w=='u')
       String[] x= word.split(w1,2);

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.