Beispiel #1
0
void RptAddConcept(Rpt *rpt, Obj *obj, Discourse *dc)
{
    char	buf[PHRASELEN];
    GenConceptString(obj, N("empty-article"), F_NOUN, F_NULL, DC(dc).lang,
                     F_NULL, F_NULL, F_NULL, PHRASELEN, 0, 1, dc, buf);
    RptAdd(rpt, buf, RPT_JUST_LEFT);
}
Beispiel #2
0
void RptAddList(Rpt *rpt, ObjList *objs, int justif, Discourse *dc)
{
    char		buf[PHRASELEN];
    ObjList	*p;
    for (p = objs; p; p = p->next) {
        GenConceptString(p->obj, N("empty-article"), F_NOUN, F_NULL,
                         DC(dc).lang, F_NULL, F_NULL, F_NULL, PHRASELEN, 1, 1,
                         dc, buf);
        RptAdd(rpt, buf, justif);
    }
}
Beispiel #3
0
/* Used in printing word syntax.
 * Long form; contrast with TextPrintWordAndFeatures.
 * (Both long and short forms are used by Dict.)
 */
void ThetaRoleTextPrint1(Text *text, int html, int lang, int position,
                         Obj *cas_restrict, ThetaRole *theta_roles, Obj *con,
                         Discourse *dc)
{
    int		subcat, slotnum, dospace;
    Obj		*cas, *restrict;
    Bool		isoptional;
    char		*p, buf[PHRASELEN], *s;
    LexEntry	*le;
    for (slotnum = 1; theta_roles; theta_roles = theta_roles->next, slotnum++) {
        if (theta_roles->cas == N("expl")) {
            slotnum--;
        }
        if (position != theta_roles->position) continue;
        if (cas_restrict && cas_restrict != theta_roles->cas) continue;
        ThetaRoleGet(theta_roles, &le, &cas, &subcat, &isoptional);
        if (cas == ObjNA) {
            buf[0] = LBRACE;
            buf[1] = TERM;
            p = buf+1;
        } else if (cas == N("expl")) {
            buf[0] = TERM;
            p = buf;
        } else if (isoptional) {
            buf[0] = LPAREN;
            buf[1] = TERM;
            p = buf+1;
        } else {
            buf[0] = LBRACKET;
            buf[1] = TERM;
            p = buf+1;
        }
        if (html) {
            TextPuts(buf, text);
        }
        if (cas != ObjNA && cas != N("expl")) {
            if (html) {
                HTML_TextPrint(text, GenConceptAbbrevString(cas, 1, dc));
            } else {
                StringCpy(p, GenConceptAbbrevString(cas, 1, dc), PHRASELEN-1);
            }
            dospace = 1;
        } else {
            dospace = 0;
        }
        if (con && (cas != N("expl"))) restrict = DbGetRestriction(con, slotnum);
        else restrict = NULL;
        if (restrict == N("concept") || restrict == N("object")) restrict = NULL;
        if (le) {
            if (dospace) {
                if (html) {
                    TextPutc(SPACE, text);
                } else {
                    StringAppendChar(buf, PHRASELEN, SPACE);
                }
                dospace = 0;
            }
            if (html) {
                LexEntryAddSep(le, le->srcphrase, PHRASELEN, buf);
                HTML_TextPrintBoldBeginIfEnglish(text, lang);
                HTML_TextPrint(text, buf);
                TextPutc(SPACE, text);
                HTML_TextPrintBoldEndIfEnglish(text, lang);
            } else {
                LexEntryAddSep(le, le->srcphrase, PHRASELEN, StringEndOf(buf));
            }
            if (cas != N("expl")) {
                if (html) {
                    TextPutc('+', text);
                } else {
                    StringAppendChar(buf, PHRASELEN, '+');
                }
            }
        }
        if (restrict && !ObjIsList(restrict)) {
            if (dospace) {
                if (html) {
                    TextPutc(SPACE, text);
                } else {
                    StringAppendChar(buf, PHRASELEN, SPACE);
                }
                dospace = 0;
            }
            if (html) {
                HTML_TextLinkToObj(text, restrict, 1, 0, 0);
            } else {
                GenConceptString(restrict, N("empty-article"), F_NOUN, F_NULL,
                                 DC(dc).lang, F_NULL, F_NULL, F_NULL, PHRASELEN,
                                 1, 0, dc, p = StringEndOf(buf));
                StringToUpperDestructive(p);
            }
            dospace = 1;
        }
        if (subcat != F_NULL) {
            if (html) {
                if ((s = GenFeatAbbrevString(subcat, 1, dc))) {
                    TextPuts(s, text);
                }
            } else {
                if ((s = GenFeatAbbrevString(subcat, 1, dc))) {
                    StringCat(buf, s, PHRASELEN);
                }
            }
        }
        if (html) {
            if (cas == ObjNA) TextPutc(RBRACE, text);
            else if (cas == N("expl")) Nop();
            else if (isoptional) TextPutc(RPAREN, text);
            else TextPutc(RBRACKET, text);
            TextPutc(SPACE, text);
        } else {
            if (cas == ObjNA) StringAppendChar(buf, PHRASELEN, RBRACE);
            else if (cas == N("expl")) Nop();
            else if (isoptional) StringAppendChar(buf, PHRASELEN, RPAREN);
            else StringAppendChar(buf, PHRASELEN, RBRACKET);
            TextPutword(buf, TERM, text);
        }
    }
}