From 6746da6edd7d9d50efe374eabbb79a3cac882d81 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 16 Jan 2017 18:02:50 -0500 Subject: Started structural rewrite The new object structure was designed to build on the existing WordNet structure, while also adding in all of the data that we get from other sources. More information about this can be found on the project wiki. The generator has already been completely rewritten to generate a datafile that uses the new structure. In addition, a number of indexes are created, which does double the size of the datafile, but also allows for much faster lookups. Finally, the new generator is written modularly and is a lot more readable than the old one. The verbly interface to the new object structure has mostly been completed, but has not been tested fully. There is a completely new search API which utilizes a lot of operator overloading; documentation on how to use it should go up at some point. Token processing and verb frames are currently unimplemented. Source for these have been left in the repository for now. --- generator/progress.h | 78 ++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 36 deletions(-) (limited to 'generator/progress.h') diff --git a/generator/progress.h b/generator/progress.h index 81f07a3..fcb680d 100644 --- a/generator/progress.h +++ b/generator/progress.h @@ -3,48 +3,54 @@ #include -class progress { - private: - std::string message; - int total; - int cur = 0; - int lprint = 0; +namespace verbly { + namespace generator { - public: - progress(std::string message, int total) : message(message), total(total) - { - std::cout << message << " 0%" << std::flush; - } + class progress { + private: + std::string message; + int total; + int cur = 0; + int lprint = 0; - void update(int val) - { - if (val <= total) - { - cur = val; - } else { - cur = total; - } + public: + progress(std::string message, int total) : message(message), total(total) + { + std::cout << message << " 0%" << std::flush; + } + + void update(int val) + { + if (val <= total) + { + cur = val; + } else { + cur = total; + } - int pp = cur * 100 / total; - if (pp != lprint) - { - lprint = pp; + int pp = cur * 100 / total; + if (pp != lprint) + { + lprint = pp; - std::cout << "\b\b\b\b" << std::right; - std::cout.width(3); - std::cout << pp << "%" << std::flush; - } - } + std::cout << "\b\b\b\b" << std::right; + std::cout.width(3); + std::cout << pp << "%" << std::flush; + } + } + + void update() + { + update(cur+1); + } - void update() - { - update(cur+1); - } + ~progress() + { + std::cout << "\b\b\b\b100%" << std::endl; + } + }; - ~progress() - { - std::cout << "\b\b\b\b100%" << std::endl; - } + }; }; #endif /* end of include guard: PROGRESS_H_A34EF856 */ -- cgit 1.4.1