Exemplo n.º 1
0
  private void split(Sentence s, Interval clause, Intervals out) {
    Interval pre = null, verb = null, post = null;
    for (Interval phrase : s.get(Features.PHRASES).in(clause)) {
      if (verb == null) {
        if (phrase.get(Features.PHRASE_TYPE) == PhraseType.VerbPhrase)
          verb = new Interval(phrase.low(), phrase.high());
        else pre = expand(pre, phrase);
      } else post = expand(post, phrase);
    }

    boolean preFocus = anyFocused(s, pre);
    boolean verbFocus = anyFocused(s, verb);
    boolean postFocus = anyFocused(s, post);

    // heuristics from Hiyakumoto, Prevost and Cassell
    if (!preFocus && !verbFocus && !postFocus) { // case 1
      maybeAdd(out, Theme, pre);
      maybeAdd(out, Rheme, verb, post);
    } else if (preFocus && verbFocus && !postFocus) { // case 2
      maybeAdd(out, Theme, pre);
      maybeAdd(out, Rheme, verb, post);
    } else if (preFocus && !verbFocus && postFocus) { // case 3
      maybeAdd(out, Theme, pre, verb);
      maybeAdd(out, Rheme, post);
    } else if (!preFocus && verbFocus && postFocus) { // case 4
      maybeAdd(out, Theme, pre, verb);
      maybeAdd(out, Rheme, post);
    } else if (preFocus && verbFocus && postFocus) { // case 5
      maybeAdd(out, Theme, pre, verb);
      maybeAdd(out, Rheme, post);
    } else if (preFocus && !verbFocus && !postFocus) { // case 6
      maybeAdd(out, Rheme, pre);
      maybeAdd(out, Theme, verb, post);
    } else if (!preFocus && verbFocus && !postFocus) { // case 7
      maybeAdd(out, Theme, pre);
      maybeAdd(out, Rheme, verb, post);
    } else if (!preFocus && !verbFocus && postFocus) { // case 8
      maybeAdd(out, Theme, pre, verb);
      maybeAdd(out, Rheme, post);
    }
  }
Exemplo n.º 2
0
 public void process(Context c, Sentence s) {
   Intervals infoStruct = new Intervals();
   for (Interval clause : s.get(Features.CLAUSES)) split(s, clause, infoStruct);
   s.set(Features.INFORMATION_STRUCTURE, infoStruct);
 }