get rid of codecvt

This commit is contained in:
Vladislav Khorev 2014-11-26 22:16:09 +00:00
parent 7a938a65c8
commit fe01bcc3db
2 changed files with 8 additions and 5 deletions

View File

@ -2,6 +2,8 @@
#include <iostream> //Xperimental -- for debug only #include <iostream> //Xperimental -- for debug only
#include "utf8utf16.h"
std::wstring NounDeclencionToWString(NounDeclencion nounDeclencion) std::wstring NounDeclencionToWString(NounDeclencion nounDeclencion)
{ {
@ -375,17 +377,19 @@ std::vector<NounStruct> RecognizeNoun(std::wstring noun)
void LoadFrequentWordSet() void LoadFrequentWordSet()
{ {
std::wifstream f("C:/Workplace/ChineseJournal/rudict/frequent_words.txt"); std::ifstream f("C:/Workplace/ChineseJournal/rudict/frequent_words.txt");
f.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t>)); //f.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t>));
std::wstring line; std::string line;
std::wstring wline;
if (f.is_open()) if (f.is_open())
{ {
while (getline(f, line)) while (getline(f, line))
{ {
frequentWordSet.insert(line); wline = UTF8to16(line.c_str());
frequentWordSet.insert(wline);
} }
f.close(); f.close();
} }

View File

@ -6,7 +6,6 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include <fstream> #include <fstream>
#include <codecvt>
#include "boost/algorithm/string.hpp" #include "boost/algorithm/string.hpp"