commit 367ecb607d156888987ec6524d5097f03bdad6dd Author: Tanmai Khanna Date: Thu Jul 4 02:45:04 2019 +0530 Implemented and Tested Queue of Sentences diff --git a/src/anaphora.cc b/src/anaphora.cc index 3f4e14b..d0ed191 100644 --- a/src/anaphora.cc +++ b/src/anaphora.cc @@ -104,12 +104,14 @@ int main(int argc, char **argv) { score_module.add_word(gen_id, sl_form, sl_tags, tl_form); + /* if( (contains(sl_tags, L"det") && contains(sl_tags, L"pos") ) )//|| contains(temp_tags, L"prn") || contains(temp_tags, L"vblex") || contains(temp_tags, L"vbser") || contains(temp_tags, L"vbhaver") || contains(temp_tags, L"vbmod") ) - /* if TL tags has det and pos OR just prn OR any verb*/ + //if TL tags has det and pos OR just prn OR any verb { final_ref = score_module.get_antecedent(); wcout << final_ref; //add antecedent to side ref of LU //CHANGE } + */ } input_stream.clear(); diff --git a/src/score.cc b/src/score.cc index c6ec31d..cabf641 100644 --- a/src/score.cc +++ b/src/score.cc @@ -7,18 +7,29 @@ using namespace std; -void showq(queue gq) +void showq(queue < vector > gq) { - queue g = gq; + queue < vector > g = gq; + while (!g.empty()) { - cout << '\t' << g.front(); + vector temp_sentence = g.front(); + + cout << "\n"; + for (std::vector::iterator i = temp_sentence.begin(); i != temp_sentence.end(); ++i) + { + wcout << (*i).wordform; + cout << ": " << (*i).score << " "; + } + + cout << "\n"; + g.pop(); } cout << '\n'; } -void clearq(queue q) +void clearq(queue < vector > q) { while(!q.empty()) { @@ -67,7 +78,7 @@ void Scoring::add_word(unsigned int input_id, wstring input_wordform, vector< ws { context.back().push_back(input_LU); //add word to the latest added sentence in the queue - if((contains(input_LU.pos_tags, L"sent"))) + if(contains(input_LU.pos_tags, L"sent")) { vector new_sentence; @@ -75,10 +86,17 @@ void Scoring::add_word(unsigned int input_id, wstring input_wordform, vector< ws if(context.size() > 4) context.pop(); //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; + showq(context); + } } } +/* + void Scoring::referential_distance() { for(vector::iterator it=antecedent_list.begin();it!=antecedent_list.end();++it) @@ -109,9 +127,11 @@ wstring Scoring::get_antecedent() return final_antecedent.tl_wordform; } - -void Scoring::clear() +*/ +void Scoring::clear() //use a destructor? { - context.clear(); - antecedent_list.clear(); + clearq(context); //empty queue + + 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 006260e..5b5d41a 100644 --- a/src/score.h +++ b/src/score.h @@ -16,6 +16,9 @@ struct unique_LU int score; }; +void showq(queue < vector > gq); +void clearq(queue q); + int contains(vector tags, wstring tag); int contains_any(vector tags, vector candidates); @@ -28,8 +31,8 @@ private: public: void add_word(unsigned int input_id, wstring input_wordform, vector< wstring > pos_tags, wstring input_tl_wordform); - void referential_distance(); - wstring get_antecedent(); + //void referential_distance(); + //wstring get_antecedent(); void clear(); };