MCPcopy Create free account
hub / github.com/davisking/dlib / user_defined_ruleset

Function user_defined_ruleset

dlib/test/parse.cpp:36–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

logFunction · 0.85
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected