commit 581e1bfd3ebfb95c791562556809f1c3aa3d8c75 Author: Tanmai Khanna Date: Thu Jul 4 19:05:16 2019 +0530 Change queue to deque diff --git a/src/score.cc b/src/score.cc index cabf641..570791a 100644 --- a/src/score.cc +++ b/src/score.cc @@ -4,16 +4,15 @@ #include #include #include +#include using namespace std; -void showq(queue < vector > gq) -{ - queue < vector > g = gq; - - while (!g.empty()) - { - vector temp_sentence = g.front(); +void showq(deque < vector > gq) +{ + for(std::deque < vector >::iterator j = gq.begin(); j != gq.end(); ++j) + { + vector temp_sentence = *j; cout << "\n"; for (std::vector::iterator i = temp_sentence.begin(); i != temp_sentence.end(); ++i) @@ -23,8 +22,6 @@ void showq(queue < vector > gq) } cout << "\n"; - - g.pop(); } cout << '\n'; } @@ -65,13 +62,13 @@ void Scoring::add_word(unsigned int input_id, wstring input_wordform, vector< ws vector sentence; //initialise a sentence sentence.push_back(input_LU); //add the first word to the sentence - context.push(sentence); + context.push_back(sentence); if(contains(input_LU.pos_tags, L"sent")) //if sentence end (somehow the first LU is a sentence end) { vector new_sentence; - context.push(new_sentence); //add an empty sentence + context.push_back(new_sentence); //add an empty sentence } } else //if queue is not empty @@ -82,20 +79,26 @@ void Scoring::add_word(unsigned int input_id, wstring input_wordform, vector< ws { vector new_sentence; - context.push(new_sentence); //add an empty sentence + context.push_back(new_sentence); //add an empty sentence if(context.size() > 4) - context.pop(); //remove the earliest added sentence (We only want current and three previous sentences in context) + context.pop_front(); //remove the earliest added sentence (We only want current and three previous sentences in context) } else if( contains(input_LU.pos_tags, L"det") && contains(input_LU.pos_tags, L"pos") ) { - anaphor = input_LU; + //apply_indicators(input_LU); showq(context); } } } - /* +void Scoring::apply_indicators(unique_LU anaphor) +{ + //Start going through sentences(current to earliest) and apply all indicators to modify scores of the NPs + +} + + void Scoring::referential_distance() { @@ -130,8 +133,8 @@ wstring Scoring::get_antecedent() */ void Scoring::clear() //use a destructor? { - clearq(context); //empty queue + context.clear(); //empty queue - unique_LU EmptyStruct; - anaphor = EmptyStruct; //empty anaphor variable + //unique_LU EmptyStruct; + //anaphor = EmptyStruct; //empty anaphor variable } \ No newline at end of file diff --git a/src/score.h b/src/score.h index 5b5d41a..edd9ac0 100644 --- a/src/score.h +++ b/src/score.h @@ -4,6 +4,7 @@ #include #include #include +#include using namespace std; @@ -16,8 +17,7 @@ struct unique_LU int score; }; -void showq(queue < vector > gq); -void clearq(queue q); +void showq(deque < vector > gq); int contains(vector tags, wstring tag); int contains_any(vector tags, vector candidates); @@ -25,8 +25,8 @@ int contains_any(vector tags, vector candidates); class Scoring { private: - queue< vector > context; //A queue of sentences. Each sentence is a vector of Lexical Units - unique_LU anaphor; + deque< vector > context; //A queue of sentences. Each sentence is a vector of Lexical Units + //unique_LU anaphor; //vector antecedent_list; //A list of antecedents public: