For Programmers: Free Programming Magazines  


Home > Archive > Prolog > July 2006 > Splitting word based on syllables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Splitting word based on syllables
mayo_matt@hotmail.com

2006-07-03, 7:02 pm

Hi all,

I'll state up front that I am looking for HELP with an assignment...
not looking to get my work done for me at all. I am finishing up a
course in Prolog and AI, and while I am doing fairly well in the course
and grasping most things, I am stuck on one of the earlier assignment
questions.

I need to read a word in from the user and then split it into syllables
based on one of 2 rules: vowel-consonant-vowel, or
vowel-consonant-consonant-vowel, with the syllabic splits hopefully
intuitive to anyone reading this :)

What I figure I should be doing is reading in the word and then using
name to generate a list of ASCII chars. I should then read char by
char from the list and compare each char to a list of vowels. Once I
encounter a vowel I should then look a the next letter to see if it is
a consonant. A syllable will be formed based on the char that follows
this one (vowel next leads to one rule while consonant leads to the
other).

I really can't figure out how to implement this practically. THe
method I have laid out seems to make sens to me, but I cannot convert
it to code.

First of all, am I on the right track? And if I am, does anyone have a
suggestion of how to star this? If I am not on course, course someone
gently nudge me in the right direction?

I'd appreciate any input or considertation that anyone may have for me.
Thanks in advance.

Bill Spight

2006-07-03, 7:02 pm

Dear mayo_matt,

>
> I'll state up front that I am looking for HELP with an assignment...
> not looking to get my work done for me at all. I am finishing up a
> course in Prolog and AI, and while I am doing fairly well in the course
> and grasping most things, I am stuck on one of the earlier assignment
> questions.
>
> I need to read a word in from the user and then split it into syllables
> based on one of 2 rules: vowel-consonant-vowel, or
> vowel-consonant-consonant-vowel, with the syllabic splits hopefully
> intuitive to anyone reading this :)
>
> What I figure I should be doing is reading in the word and then using
> name to generate a list of ASCII chars. I should then read char by
> char from the list and compare each char to a list of vowels. Once I
> encounter a vowel I should then look a the next letter to see if it is
> a consonant. A syllable will be formed based on the char that follows
> this one (vowel next leads to one rule while consonant leads to the
> other).
>
> I really can't figure out how to implement this practically. THe
> method I have laid out seems to make sens to me, but I cannot convert
> it to code.
>
> First of all, am I on the right track? And if I am, does anyone have a
> suggestion of how to star this? If I am not on course, course someone
> gently nudge me in the right direction?
>
> I'd appreciate any input or considertation that anyone may have for me.
> Thanks in advance.


Here is a hint that may help.

If you have a list with at least two elements, you may think of it as

[X1, X2 | Xs]

Good luck!

Bill
Advait

2006-07-03, 7:02 pm

Hi,

mayo_matt@hotmail.com wrote:

> Hi all,
>
> I'll state up front that I am looking for HELP with an assignment...
> not looking to get my work done for me at all. I am finishing up a
> course in Prolog and AI, and while I am doing fairly well in the course
> and grasping most things, I am stuck on one of the earlier assignment
> questions.
>
> I need to read a word in from the user and then split it into syllables
> based on one of 2 rules: vowel-consonant-vowel, or
> vowel-consonant-consonant-vowel, with the syllabic splits hopefully
> intuitive to anyone reading this :)
>
> What I figure I should be doing is reading in the word and then using
> name to generate a list of ASCII chars. I should then read char by
> char from the list and compare each char to a list of vowels. Once I
> encounter a vowel I should then look a the next letter to see if it is
> a consonant. A syllable will be formed based on the char that follows
> this one (vowel next leads to one rule while consonant leads to the
> other).
>
> I really can't figure out how to implement this practically. THe
> method I have laid out seems to make sens to me, but I cannot convert
> it to code.
>
> First of all, am I on the right track? And if I am, does anyone have a
> suggestion of how to star this? If I am not on course, course someone
> gently nudge me in the right direction?
>
> I'd appreciate any input or considertation that anyone may have for me.
> Thanks in advance.


Probably I can help you.

Use atom_chars to convert user input atom into list.
Then use append to split the list into randome parts.
Define a validator which can validate List's pieces according to
required rules.
end

Yours,
Advait

mayo_matt@hotmail.com

2006-07-03, 9:59 pm


Bill Spight wrote:
> Dear mayo_matt,
>
>
> Here is a hint that may help.
>
> If you have a list with at least two elements, you may think of it as
>
> [X1, X2 | Xs]
>
> Good luck!
>
> Bill


Thanks to both Bill and Advait. I have made a breakthrough with this
and a little more tinkering should get it to exactly where I want it!

Thanks to you both. Cheers!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com