Exemplo n.º 1
0
/* NEGATIVES:
 *   English "not" occurs as W B.
 *   French "ne" occurs as B W.
 *   French "pas" occurs as B W (in "ne pas") or W B.
 * OTHER ADVERBS:
 *   English adverbs can occur as B W or W B.
 *   todo: Use W B when W is auxiliary verb.
 *   French adverbs (except for "ne") can occur only as W B.
 * EXAMPLES:
 *   [W [W [W [W [V should]] [B happily]] [B not]] [W [V change]]]
 *   [W [W [W [V do]] [B not]] [W [B happily] [W [V change]]]]
 *   "Je [B ne] [W sais] pas"
 *   "I [B [W have] [B carefully]] [W checked] the reactor settings."
 *   "I [W have] [[B carefully] [W checked]] the reactor settings."
 *   "I [B carefully] [W check] the reactor settings."
 *   "I [W check] [B carefully] to see what the problem is."
 *   "Paganini [W played the violin] [B beautifully]."
 *
 * One might think that some restrictions-such as "just" coming before
 * the verb or after the auxiliary-might not be needed in parsing because
 * we are only presented with well-formed input. But we can always come
 * up with cases where they are needed: "I finished just my homework."
 * "I just finished my homework."
 *
 * todoSCORE: Adverbs of manner tend to occur at end of sentence or between
 * subject and verb.
 */
Float Syn_ParseFilterBW_WB_W(PNode *b, PNode *w, int is_bw, int lang)
{
  LexEntry	*adv_le;
  if (Syn_Parse_IsOnlyRelativeW(w, lang)) return(0.0);
  if ((adv_le = PNodeLeftmostLexEntry(b))) {
    if (LexEntryAllConceptsFeat(is_bw ? F_NO_BW_W : F_NO_WB_W, adv_le)) {
    /* Disallow intensifiers such as "very" and "très" and so on. */
      return(0.0);
    }
    /* Hardcoded word restrictions: */
    if (lang == F_FRENCH) {
      if (streq(adv_le->srcphrase, "pas")) {
        if (PNodeFeaturesIn(w, FS_NP_PP)) return(0.0);
      } else if (streq(adv_le->srcphrase, "ne")) {
        if (!is_bw) return(0.0);
        return(Syn_ParseFilter_Verb_Or_InterHB(w));
      } else {
        if (is_bw) return(0.0);
      }
    } else if (lang == F_ENGLISH) {
      if (streq(adv_le->srcphrase, "not")) {
        if (is_bw || (!PNodeFeaturesIn(w, FS_NP_PP))) {
          return(0.0);
        }
      }
    }
  }
  return(1.0);
}
Exemplo n.º 2
0
Float Syn_ParseFilterDX_X(PNode *d, PNode *x, int lang)
{
  if (PNodeFeatureIn(x, F_DETERMINER)) {
  /* todo: However, if <d> is a predeterminer, this is acceptable
   * (Battye and Hintze, 1992, p. 216).
   * Might be OK as is, because tout(e)(s) is currently considered an
   * adjective.
   */
    return(0.0);
  }
  if (x->pn1 && x->pn1->feature == F_S) return(0.0);
  if (PNodeFeaturesIn(x, FS_VP_PP)) {
  /* Determiners should occur at the lowest, innermost level, since they
   * are X-MAX arguments.
   * That is, we allow:
   * [X [X [D the] [X [N grocer]]]
   *     [Y [R of] .]]
   * and disallow:
   * [X [D the]
   *     [X [X [N grocer]] [Y [R of] ...]]]
   * also [the [grocer who did whatever]]
   */
    return(0.0);
  }
  return(1.0);
}
Exemplo n.º 3
0
Float Syn_ParseFilterWV_W(PNode *w, PNode *v, int lang)
{
  if (Syn_Parse_IsOnlyRelativeW(w, lang)) return(0.0);
  if (PNodeFeaturesIn(w, FS_NP_PP)) {
  /* Verb arguments should go at a higher level.
   * "The American who is Jim Garnier's sister, ate."
   */
    return(0.0);
  }
  return(1.0);
}