diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-10-31 13:20:09 +0000 |
---|---|---|
committer | benjamin <benjamin@daaaf23c-2e50-4459-9457-1e69db5a47bf> | 2014-10-31 13:20:09 +0000 |
commit | c54065160a03f266c1406edf74d97ab74ee75d51 (patch) | |
tree | 68b3d83aee2b592b94130892461a368f7756a210 /src/core/utils/Tokenizer.cpp | |
parent | 73cc54cbf494d9da61b640035f25ad9c5eb86d84 (diff) |
finished work on TokenTree and tested it.
git-svn-id: file:///var/local/svn/basicwriter@88 daaaf23c-2e50-4459-9457-1e69db5a47bf
Diffstat (limited to 'src/core/utils/Tokenizer.cpp')
-rw-r--r-- | src/core/utils/Tokenizer.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/core/utils/Tokenizer.cpp b/src/core/utils/Tokenizer.cpp index 1a84f0c..38f7585 100644 --- a/src/core/utils/Tokenizer.cpp +++ b/src/core/utils/Tokenizer.cpp @@ -21,11 +21,11 @@ namespace ousia { namespace utils { -static std::unordered_map<char, TokenTreeNode> buildChildren( +static std::map<char, TokenTreeNode> buildChildren( const std::map<std::string, int> &inputs) { - std::std::unordered_map<char, TokenTreeNode> children; - std::unordered_map<char, std::map<std::string, int>> nexts; + std::map<char, TokenTreeNode> children; + std::map<char, std::map<std::string, int>> nexts; for (auto &e : inputs) { const std::string &s = e.first; @@ -57,7 +57,7 @@ static int buildId(const std::map<std::string, int> &inputs) if (e.first.empty()) { if (tokenId != -1) { throw TokenizerException{std::string{"Ambigous token found: "} + - e.second}; + std::to_string(e.second)}; } else { tokenId = e.second; } @@ -67,10 +67,9 @@ static int buildId(const std::map<std::string, int> &inputs) } TokenTreeNode::TokenTreeNode(const std::map<std::string, int> &inputs) - : children(buildChildren(inputs), tokenId(buildId(inputs))) + : children(buildChildren(inputs)), tokenId(buildId(inputs)) + { } - } } - |