ios stuff

This commit is contained in:
vladislav.khorev committed 2014-12-14 00:12:23 +00:00
1 parent 07f372acb0
commit 6f57762c59
29 files changed
+1291 -79

No files matched your search

+3 -1
View File
@@ -6,8 +6,10 @@
#include "utf8utf16.h"
#include "boost/regex.hpp"
#include "boost/algorithm/string/regex.hpp"
namespace AJ
{
@@ -391,7 +393,7 @@ namespace AJ
return{ base + L"ый", base + L"ой" };
}
return{};
return std::set<std::wstring>();
}
+2 -1
View File
@@ -206,9 +206,10 @@ std::wstring NounGrammaticalCaseToWString(NounGrammaticalCase nounGrammaticalCas
case NGC_P4_ACCUSATIVE: return L"NGC_P4_ACCUSATIVE";
case NGC_P5_INSTRUMENTAL: return L"NGC_P5_INSTRUMENTAL";
case NGC_P6_PREPOSITIONAL: return L"NGC_P6_PREPOSITIONAL";
default: return L"";
}
return L"";
}
NounGrammaticalCase WStringToNounGrammaticalCase(std::wstring str)
@@ -136,82 +136,6 @@ namespace http {
return true;
}
void RemoveDuplicates(std::vector<std::shared_ptr<WordPairInterface>>& wordPairSet)
{
size_t i = 0;
while (i < wordPairSet.size())
{
size_t j = i + 1;
while (j < wordPairSet.size())
{
if (*wordPairSet[i] == *wordPairSet[j])
{
wordPairSet.erase(wordPairSet.begin() + j);
j--;
}
j++;
}
i++;
}
}
boost::property_tree::wptree PrepareReport(std::wstring request)
{
boost::property_tree::wptree result;
std::cout <<"PrepareReport" << std::endl;
if (request.size() < 2)
{
result.put(L"error", L"String is too short");
}
int id = 0;
std::vector<std::shared_ptr<WordPairInterface>> wordPairSet;
NN::RecognizeNoun(request, wordPairSet);
AJ::RecognizeAdjective(request, wordPairSet);
VB::RecognizeVerb(request, wordPairSet);
OT::RecognizeWord(request, wordPairSet);
PP::RecognizeWord(request, wordPairSet);
RemoveDuplicates(wordPairSet);
boost::property_tree::wptree wordArr;
for (auto& wordPair : wordPairSet)
{
boost::property_tree::wptree nounTree;
nounTree.put(L"id", id);
nounTree.put(L"type", wordPair->getType());
nounTree.put(L"word", wordPair->word().GetWord());
nounTree.put_child(L"properties", wordPair->word().GetProperties());
nounTree.put_child(L"modificators", wordPair->wordModificator().GetModificators());
nounTree.put_child(L"translations", wordPair->word().CreateTranslationPropertyTree());
wordArr.push_back(std::make_pair(L"", nounTree));
id++;
}
result.put_child(L"words", wordArr);
return result;
}
} // namespace server
} // namespace http
@@ -14,6 +14,8 @@
#include <string>
#include "boost/property_tree/ptree.hpp"
#include "../reporter.h"
namespace http {
namespace server {
@@ -40,7 +42,6 @@ private:
static bool url_decode(const std::string& in, std::string& out);
};
boost::property_tree::wptree PrepareReport(std::wstring request);
} // namespace server
} // namespace http