How can I write a program in prolog that breaks a word into syllables using predicate: First syllable is vowel-consonant-vowel .. or Second syllable: vowel-consonant-consonant-vowel. For example; abandon = aba-ndon ..
相关问题
- Creating a SPARQL parameterized query using append
- How to join rules and print out outputs in prolog
- Splitting list and iterating in prolog
- Accumulating while in recursion/backtracking
- prolog trace how to use
相关文章
- What are the problems associated to Best First Sea
- How can I fix this circular predicate in Prolog?
- How to negate in Prolog
- Remove incorrect subsequent solutions without once
- prolog two lists are exactly the same
- Simplify Expressions in Prolog
- Check if any element's frequency is above a li
- Prolog — symetrical predicates
This program will basically apply the rules you mention, but I don't think it will make a good tool for word processing.
The program defines what a vowel is and what it is not. Also a syllable according to your rules, and how to break a word. Using the predicate ´break/2´ you can test it:
What makes me doubt about your rules, besides my poor English, is that testing with each word of my answer, returns the entire word always :)
There's a publically available list of words split into "syllables" (not sure exactly what the criteria is) here. Each line is a word, so you could read the words in one at time, split them into syllables, and store them in some dynamic predicate. Suppose the file is called
mhypth.txt
, as it is at the link above:If you load this into your SWI Prolog interpreter, you can then do something like this: