commit 0feba1eceefdc2f45c382aead583c19748e7ddbe Author: Tanmai Khanna Date: Sat Jun 22 03:55:30 2019 +0530 changing vector to wstring in parse code diff --git a/src/parse_biltrans.cc b/src/parse_biltrans.cc index 77b1f9b..afc08cf 100644 --- a/src/parse_biltrans.cc +++ b/src/parse_biltrans.cc @@ -2,15 +2,16 @@ #include #include +#include using namespace std; -LexicalUnit::LexicalUnit(vector input_LU) +LexicalUnit::LexicalUnit(wstring input_LU) { int seenSlash = 0; int seenTag = 0; - vector temptag; + wstring temptag; for (auto i = input_LU.begin(); i != input_LU.end(); ++i) { @@ -112,48 +113,40 @@ LexicalUnit::LexicalUnit(vector input_LU) } } -vector LexicalUnit::get_sl_form() +wstring LexicalUnit::get_sl_form() { return sl_form; } -vector LexicalUnit::get_tl_form() +wstring LexicalUnit::get_tl_form() { return tl_form; } -vector< vector > LexicalUnit::get_sl_tags() +vector< wstring > LexicalUnit::get_sl_tags() { return sl_tags; } -vector< vector > LexicalUnit::get_tl_tags() +vector< wstring > LexicalUnit::get_tl_tags() { return tl_tags; } -/* //Uncomment to test this code + /* //Uncomment to test this code -void print(vector const &input) +void print_tags(vector< wstring > input) { - for (int i = 0; i < input.size(); i++) { - std::cout << input.at(i); - } -} - -void print_tags(vector< vector > const &input) -{ - for (int i = 0; i < input.size(); i++) { - for(int j = 0; j < input.at(i).size(); j++) { - cout << input.at(i).at(j); - } + for (int i = 0; i < input.size(); i++) + { + wcout << input[i]; cout << " "; } } int main() { - vector inputlu; + wstring inputlu; char input_char; input_char = fgetc(stdin); @@ -168,11 +161,11 @@ int main() LexicalUnit lu(inputlu); cout << "SL: "; - print(lu.get_sl_form()); + wcout << lu.get_sl_form(); cout << endl << "SL tags: "; print_tags(lu.get_sl_tags()); cout << endl << "TL: "; - print(lu.get_tl_form()); + wcout << lu.get_tl_form(); cout << endl << "TL tags: "; print_tags(lu.get_tl_tags()); cout << endl; diff --git a/src/parse_biltrans.h b/src/parse_biltrans.h index 87351fd..321f811 100644 --- a/src/parse_biltrans.h +++ b/src/parse_biltrans.h @@ -2,6 +2,7 @@ #define _PARSEBILTRANS_ #include +#include using namespace std; @@ -15,49 +16,49 @@ private: /** * Source language word and tags */ - vector sl_form; + wstring sl_form; /** * Target language word and tags */ - vector tl_form; + wstring tl_form; /** * Source language tags */ - vector< vector > sl_tags; + vector< wstring > sl_tags; /** * Target language tags */ - vector< vector > tl_tags; + vector< wstring > tl_tags; public: /** * Constructor to fill all variables * @param input_LU one lexical unit between ^ and $ (excluded) */ - LexicalUnit(vector input_LU); + LexicalUnit(wstring input_LU); /** * Return the Source Language Form */ - vector get_sl_form(); + wstring get_sl_form(); /** * Return the Target Language Form */ - vector get_tl_form(); + wstring get_tl_form(); /** * Return the Source Language Tags */ - vector< vector > get_sl_tags(); + vector< wstring > get_sl_tags(); /** * Return the Target Language Form */ - vector< vector > get_tl_tags(); + vector< wstring > get_tl_tags(); };