commit 7a5f6b247f78c391b14cfc035f42a5d1e1f2d144 Author: Tanmai Khanna Date: Sat Jun 22 04:39:04 2019 +0530 Changed all vector to wstring | removed all warnings while compiling diff --git a/src/anaphora.cc b/src/anaphora.cc index 8e3ef9a..d0fa756 100644 --- a/src/anaphora.cc +++ b/src/anaphora.cc @@ -4,18 +4,11 @@ #include #include #include +#include using namespace std; -void print(vector const &input) -{ - for (int i = 0; i < input.size(); i++) - { - fprintf(stdout, "%c", input.at(i)); - } -} - -int contains(vector< vector > tags, vector tag) +int contains(vector tags, wstring tag) { if(std::find(tags.begin(), tags.end(), tag) != tags.end()) return 1; @@ -23,34 +16,38 @@ int contains(vector< vector > tags, vector tag) return 0; } -vector string_to_vector(char *string_in) +int contains_any(vector tags, vector candidates) { - vector temp; - - for(int i = 0; i < strlen(string_in); i++) - temp.push_back(string_in[i]); + for(vector::iterator it=candidates.begin();it!=candidates.end();++it) + { + if(std::find(tags.begin(), tags.end(), *it) != tags.end()) + return 1; //if any of the tags in candidates matches the tags list + } - return temp; + return 0; //if no matches } -int main() +struct sal_score { - char input_char; + wstring wordform; + int score; +}; - input_char = fgetc(stdin); +int main() +{ - vector input_stream; - vector last_noun; + vector< sal_score > scores; + sal_score unit; - vector temp_form; - vector< vector > temp_tags; + char input_char; - vector antecedent_tag = string_to_vector("n"); + input_char = fgetc(stdin); - vector r1_tag1 = string_to_vector("det"); - vector r1_tag2 = string_to_vector("pos"); + wstring input_stream; + wstring last_noun; - vector r2_tag1 = string_to_vector("prn"); + wstring temp_form; + vector< wstring > temp_tags; int flag_LU = 0; @@ -102,16 +99,16 @@ int main() if(!temp_form.empty()) //if TL exists { - if(contains(temp_tags, antecedent_tag)) + if(contains(temp_tags, L"n")) /* if TL contains antecedent tag */ { last_noun = temp_form; } - if((contains(temp_tags, r1_tag1) && contains(temp_tags, r1_tag2)) || contains(temp_tags, r2_tag1)) + if((contains(temp_tags, L"det") && contains(temp_tags, L"pos")) || contains(temp_tags, L"prn")) /* if TL tags has det and pos OR just prn*/ { - print(last_noun); //add last seen noun to LU + wcout << last_noun; //add last seen noun to LU //CHANGE } } diff --git a/src/parse_biltrans.cc b/src/parse_biltrans.cc index afc08cf..2e9d82a 100644 --- a/src/parse_biltrans.cc +++ b/src/parse_biltrans.cc @@ -13,7 +13,7 @@ LexicalUnit::LexicalUnit(wstring input_LU) wstring temptag; - for (auto i = input_LU.begin(); i != input_LU.end(); ++i) + for (std::wstring::iterator i = input_LU.begin(); i != input_LU.end(); ++i) { if(*i == '\\') //dealing with escaped characters { @@ -133,7 +133,7 @@ vector< wstring > LexicalUnit::get_tl_tags() return tl_tags; } - /* //Uncomment to test this code +/* //Uncomment to test this code void print_tags(vector< wstring > input) { @@ -172,7 +172,6 @@ int main() return 0; } - */ diff --git a/src/parse_biltrans.h.gch b/src/parse_biltrans.h.gch new file mode 100644 index 0000000..fa26f59 Binary files /dev/null and b/src/parse_biltrans.h.gch differ