int word_break(char *str) { int len = strlen(str); int i=0; for(i=1; i<=len; i++) { if(dict_contains(substr(str,0,i)) && word_break(substr(str,i, len-1))) return 1; } return 0; }
static const cst_val *syl_break(const cst_item *syl) { /* Break level after this syllable */ cst_item *ss; ss = item_as(syl,"SylStructure"); if (ss == NULL) return VAL_STRING_1; /* hmm, no sylstructure */ else if (item_next(ss) != NULL) return VAL_STRING_0; /* word internal */ else if (item_parent(ss) == NULL) /* no parent */ return VAL_STRING_1; else return word_break(item_parent(ss)); }
int main() { printf("mango is present %d", word_break("mango")); return 0; }