// Copyright 2012 Google Inc. All Rights Reserved.
//
// Contact dialing grammar.
//
// For completeness. On the client side $CONTACT is added and $VOICE_DIALING
// and $TARGET are defined either as:
//    1) $VOICE_DIALING = $CONTACT_AND_DIGIT_DIALING;
//       $TARGET = $CONTACT; or
//    2) $VOICE_DIALING = $DIGIT_DIALING;  // If contact list is not available.

tag-semantics <literal>;

$root = /0.07/ $VOICE_DIALING | /0.93/ $OTHER;

$CONTACT_AND_DIGIT_DIALING = /0.95/ $CONTACT_CALLING | /0.05/ $DIGIT_DIALING;

$CONTACT_CALLING = [please] ((/0.94/ $CONTACT_CALL | /0.03/ dial | /0.02/ phone | /0.01/ get)  {_call}) {___<scrub>___} $TARGET {___</scrub>___} $SUFFIX;

$CONTACT_CALL =
      /0.87/ call |
      /0.08/ (make a [phone] call to) |
      /0.05/ (place a [phone] call to);

$SUFFIX = [$MOBILE | $WORK | $HOME];

$HOME = ([at | at $PRON] | [on | on $PRON_THE]) $HOME_BASE [phone];
$ON_AT = /0.85/ on | /0.15/ at;
$MOBILE = ([$ON_AT | $ON_AT $PRON] | [$ON_AT | $ON_AT $PRON_THE]) $MOBILE_BASE [phone];
$WORK = ([at | at $PRON] | [on | on $PRON_THE]) $HOME_BASE [phone];

$PRON = (his | her | their);
$PRON_THE = $PRON | the;
$HOME_BASE = (home | house) {_p1};
$MOBILE_BASE = (mobile | cell | cellular) {_p2};
$WORK_BASE = (business | work | office) {_p3};

$DIGIT_DIALING = [please] ((/0.7/ $DIGIT_CALL | /0.22/ dial | /0.08/ phone) {_call}) [the number] {___<scrub>___} $LITERAL_NUM {___</scrub>___};

$DIGIT_CALL =
      /0.75/ call |
      /0.17/ (make a [phone] call to) |
      /0.08/ (place a [phone] call to);

$LITERAL_NUM = $digit<7-15>;
$digit = $digit0 | $digit1 | $digit2 | $digit3 | $digit4 | $digit5 | $digit6 | $digit7 | $digit8 | $digit9;
$digit0 = (0 {_d0});
$digit1 = (1 {_d1});
$digit2 = (2 {_d2});
$digit3 = (3 {_d3});
$digit4 = (4 {_d4});
$digit5 = (5 {_d5});
$digit6 = (6 {_d6});
$digit7 = (7 {_d7});
$digit8 = (8 {_d8});
$digit9 = (9 {_d9});

$OTHER = ($OTHER_WORDS<1->) {_other};
$OTHER_WORDS =
        the |
        be |
        to |
        of |
        and |
        a |
        in |
        that |
        have |
        i |
        it |
        for |
        not |
        on |
        with |
        he |
        as |
        you |
        do |
        at |
        this |
        but |
        his |
        by |
        from |
        they |
        we |
        say |
        her |
        she |
        or |
        an |
        will |
        my |
        one |
        all |
        would |
        there |
        their |
        what |
        so |
        up |
        out |
        if |
        about |
        who |
        get |
        which |
        go |
        me |
        when |
        make |
        can |
        like |
        time |
        no |
        just |
        him |
        know |
        take |
        person |
        into |
        year |
        your |
        good |
        some |
        could |
        them |
        see |
        other |
        than |
        then |
        now |
        look |
        only |
        come |
        its |
        over |
        think |
        also |
        back |
        after |
        use |
        two |
        how |
        our |
        work |
        first |
        well |
        way |
        even |
        new |
        want |
        because |
        any |
        these |
        give |
        day |
        most |
        us
        ;
