| 34 | |
| 35 | template <bool has_glue_term> |
| 36 | void user_defined_ruleset ( |
| 37 | const std::vector<tags>& words, |
| 38 | const constituent<tags>& c, |
| 39 | std::vector<std::pair<tags,double> >& possible_ids |
| 40 | ) |
| 41 | { |
| 42 | DLIB_TEST(c.begin < c.k && c.k < c.end && c.end <= words.size()); |
| 43 | DLIB_TEST(possible_ids.size() == 0); |
| 44 | |
| 45 | if (c.left_tag == NP && c.right_tag == VP) possible_ids.push_back(make_pair(S,log(0.80))); |
| 46 | else if (c.left_tag == DET && c.right_tag == N) possible_ids.push_back(make_pair(NP,log(0.30))); |
| 47 | else if (c.left_tag == VP && c.right_tag == A) possible_ids.push_back(make_pair(VP,log(0.30))); |
| 48 | else if (c.left_tag == V && c.right_tag == NP) |
| 49 | { |
| 50 | possible_ids.push_back(make_pair(VP,log(0.20))); |
| 51 | possible_ids.push_back(make_pair(B,0.10)); |
| 52 | } |
| 53 | else if (has_glue_term) |
| 54 | { |
| 55 | possible_ids.push_back(make_pair(G, log(0.01))); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // ---------------------------------------------------------------------------------------- |
| 60 | |