// Copyright 2018, University of Freiburg, // Chair of Algorithms and Data Structures. // Authors: Patrick Brosi #ifndef PFAEDLE_TRGRAPH_NORMALIZER_H_ #define PFAEDLE_TRGRAPH_NORMALIZER_H_ #include #include #include #include #include namespace pfaedle { namespace trgraph { typedef std::pair ReplRule; typedef std::vector ReplRules; typedef std::pair ReplRuleComp; typedef std::vector ReplRulesComp; /* * A class for normalizing station names */ class Normalizer { public: Normalizer() {} explicit Normalizer(const ReplRules& rules); // Normalize sn based on the rules of this normalizer std::string operator()(std::string sn) const; bool operator==(const Normalizer& b) const; private: ReplRulesComp _rules; ReplRules _rulesOrig; mutable std::unordered_map _cache; void buildRules(const ReplRules& rules); }; } // namespace trgraph } // namespace pfaedle #endif // PFAEDLE_TRGRAPH_NORMALIZER_H_