commit 8f6c59642d66160ce220760f08a9c86835f92107 Author: Tanmai Khanna Date: Tue Jul 30 12:12:38 2019 +0530 Impeding indicator PP takes score from ref file now diff --git a/src/parse_ref.cc b/src/parse_ref.cc index 865dae0..f4b6b3f 100644 --- a/src/parse_ref.cc +++ b/src/parse_ref.cc @@ -204,6 +204,8 @@ vector ParseRef::parsePatternItem (xmlDocPtr doc, xmlNodePtr c void ParseRef::parsePatterns (xmlDocPtr doc, xmlNodePtr cur, wstring markable_name) { + xmlChar *Attr; + cur = cur->xmlChildrenNode; //wcerr << markable_name; @@ -225,7 +227,7 @@ void ParseRef::parsePatterns (xmlDocPtr doc, xmlNodePtr cur, wstring markable_na int score_int = std::stoi(score_ws); - markable_score[markable_name] = score_int; + markables_score[markable_name] = score_int; } cur = cur->next; @@ -326,6 +328,11 @@ unordered_map ParseRef::get_markables() return markables; } +unordered_map ParseRef::get_markables_score() +{ + return markables_score; +} + /* //Code for Testing int main(int argc, char **argv) { diff --git a/src/parse_ref.h b/src/parse_ref.h index b7de48b..e2f1d39 100644 --- a/src/parse_ref.h +++ b/src/parse_ref.h @@ -31,7 +31,7 @@ private: unordered_map cats; //cat name mapped to acceptable tag lists unordered_map markables; //markable name mapped to acceptable pattern lists. Also each pattern has a head == 1 - unordered_map markable_score; //markable name mapped to score of markable + unordered_map markables_score; //markable name mapped to score of markable public: void parseDoc(char *docname); @@ -51,6 +51,8 @@ public: unordered_map get_cats(); unordered_map get_markables(); + + unordered_map get_markables_score(); }; #endif \ No newline at end of file diff --git a/src/score.cc b/src/score.cc index aac2c12..f14d72d 100644 --- a/src/score.cc +++ b/src/score.cc @@ -82,6 +82,8 @@ void Scoring::apply_indicators(unique_LU anaphor, ParseRef ref_file) //Go through the context and add properties based on external file deque< vector > context_with_prop = add_properties(context, ref_file); //dont add properties in the actual context (might wanna change) + //Get scores for markables in a variable + unordered_map markables_score = ref_file.get_markables_score(); //Start going through sentences(current to earliest) and apply all indicators to modify scores of the NPs for(deque< vector >::reverse_iterator i = context_with_prop.rbegin(); i!=context_with_prop.rend(); ++i) //read through the queue in reverse @@ -116,11 +118,12 @@ void Scoring::apply_indicators(unique_LU anaphor, ParseRef ref_file) } //Impeding Indicators + if(contains(antecedent_LU.properties, L"PP")) { - temp_score -= 1; //Prepositional NP + temp_score += markables_score[L"PP"]; //Prepositional NP } - + //Add to Antecedent List with Score antecedent antecedent_with_score = {antecedent_LU, temp_score}; antecedent_list.push_back(antecedent_with_score);