Exemple #1
0
/* All conjunctions usable at the sentential level MUST be marked
 * with an FT_SUBCAT. Those that can't (such as "well at least")
 * aren't.
 */
Bool Syn_ParseZZ_ZConjunctionOK(PNode *pn)
{
  LexEntryToObj	*leo;
  if (pn == NULL) return(0);
  if (pn->lexitem == NULL) return(0);
  if (pn->lexitem->le == NULL) return(0);
  if (pn->lexitem->le->leo == NULL) return(0);
  for (leo = pn->lexitem->le->leo; leo; leo = leo->next) {
    if (F_NULL != ThetaRoleGetAnySubcat(leo->theta_roles)) return(1);
  }
  return(0);
}
Exemple #2
0
/* todo: Something compatible with the dialect is chosen.
 * Alter this to PREFER dialect-specific choices?
 * <value_prop> can also just be value number.
 */
ObjToLexEntry *ObjToLexEntryGet3(Obj *obj, Obj *value_prop, char *features,
                                 char *not_usagefeat, int subcat, int paruniv,
                                 int *theta_filled, int pass_two,
                                 Discourse *dc)
{
  int		i, pos, address;
  char		features1[FEATLEN];
  ObjToLexEntry *ole, *p;
  ole = obj->ole;
  address = DiscourseAddress(dc);
  if (dc->ga.qwq &&
      (ISA(N("question-word"), obj) || ISA(N("copula"), obj))) {
    StringCpy(features1, features, FEATLEN);
    StringElimChar(features1, F_NOUN);
    features = features1;
  }
  for (i = 0, p = ole; p; i++, p = p->next) {
    if (i >= MAXOLELEN) {
      Dbg(DBGGENER, DBGBAD, "increase MAXOLELEN");
      break;
    }
    pos = FeatureGet(p->le->features, FT_POS);

    /* todo: For super debugging, if we return NULL from this function,
     * print out list of why each lexical entry failed.
     */
    consider[i] = ((DC(dc).lang == FeatureGetRequired("ObjToLexEntryGet",
                                                      p->le->features,
                                                      FT_LANG))
                   && StringAnyIn(features, p->le->features)
                   && paruniv == FeatureGet(p->features, FT_PARUNIV)
                   && (subcat == F_NULL ||
                       subcat == ThetaRoleGetAnySubcat(p->theta_roles))
                   && F_NULL == FeatureGet(p->features, FT_CONNOTE) /* todo */
                   && FeatureDialectMatch(DC(dc).dialect,
                                          FeatureGet(p->features, FT_DIALECT))
                   && DC(dc).style == FeatureGet(p->features, FT_STYLE)
                   && FeatureTaskOK(p->features, dc->task)
                   && FeatureMatch(address, FeatureGet(p->features, FT_ADDRESS))
                   && (not_usagefeat == NULL ||
                       (!StringAnyIn(not_usagefeat, p->features)))
                   && ((pos != F_NOUN) || ISA(N("relation"), obj) ||
                       ThetaRoleMatch(theta_filled, p->theta_roles, pass_two)));
    Nop(); /* Debugging anchor. */
  }
  if (!dc->ga.consistent) {
    for (i = 0, p = ole; p && i < MAXOLELEN; i++, p = p->next) {
      if (consider[i] && F_FREQUENT == ((uc)FeatureGet(p->features, FT_FREQ)) &&
          p->lastused == UNIXTSNA) {
        p->lastused = time(NULL); return(p);
      }
    }
    for (i = 0, p = ole; p && i < MAXOLELEN; i++, p = p->next) {
      if (consider[i] && F_NULL == FeatureGet(p->features, FT_FREQ) &&
          p->lastused == UNIXTSNA) {
        p->lastused = time(NULL); return(p);
      }
    }
    if (DC(dc).infrequent_ok) {
      for (i = 0, p = ole; p && i < MAXOLELEN; i++, p = p->next) {
        if (consider[i] && F_INFREQUENT == FeatureGet(p->features, FT_FREQ) &&
            p->lastused == UNIXTSNA) {
          p->lastused = time(NULL); return(p);
        }
      }
    }
  }
  if (pass_two) {
    /* In this case ObjToLexEntryClearLastused has already been done. */
    return(NULL);
  }
  ObjToLexEntryClearLastused(ole, dc);
  for (i = 0, p = ole; p && i < MAXOLELEN; i++, p = p->next) {
    if (consider[i] && F_FREQUENT == FeatureGet(p->features, FT_FREQ)) {
      p->lastused = time(NULL); return(p);
    }
  }
  for (i = 0, p = ole; p && i < MAXOLELEN; i++, p = p->next) {
    if (consider[i] && F_NULL == FeatureGet(p->features, FT_FREQ)) {
      p->lastused = time(NULL); return(p);
    }
  }
  /* Note in this case we do permit the generation of infrequent. */
  for (i = 0, p = ole; p && i < MAXOLELEN; i++, p = p->next) {
    if (consider[i] && F_INFREQUENT == FeatureGet(p->features, FT_FREQ)) {
      p->lastused = time(NULL); return(p);
    }
  }
  return(NULL);
}