void TA_LexEntry(Channel *ch, Discourse *dc) { int numwords, cur, prev, mods, max_words; char *p, *rest, phrase[PHRASELEN], postpunc[PUNCLEN]; HashTable *ht; ht = DC(dc).ht; prev = TERM; p = (char *)ch->buf; if (dc->mode & DC_MODE_COMPOUND_NOUN) max_words = 1; else max_words = MaxWordsInPhrase+1; while (*p) { cur = *((uc *)p); if (LexEntryNonwhite(cur) && (!LexEntryNonwhite(prev))) { /* At start of word/phrase. */ for (numwords = 1; numwords <= max_words; numwords++) { if (StringGetNWords_LeNonwhite(phrase, postpunc, p, PHRASELEN, numwords, &rest)) { if (!TA_LexEntry1(phrase, postpunc, p, rest, prev, ht, ch, dc, numwords == 1)) { /* todo: Inelegant. This is required to deal with "." at end of * sentence. This may eliminate needed dots. A better solution * is to eliminate dots specifically where EOS is detected. */ StringElims(phrase, LE_NONWHITESPACE, &mods); if (mods) { TA_LexEntry1(phrase, postpunc, p, rest, prev, ht, ch, dc, numwords == 1); } } } } } prev = cur; p++; } }
void StringElimPunctDest(char *to) { StringElims(to, ".&", NULL); }