From 3aceae8ab1eb5992110ea57a9479bbc3177feb21 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 16 Mar 2016 11:27:16 -0400 Subject: Added more inflections, word relationships, and pronunciations Nouns, adjectives, and adverbs now have inflected forms. A large number of WordNet word relationships (all noun-noun relationships, plus synonymy and antonymy for all word types except verbs) have been added. Additionally, CMUDICT is now being used to store word pronunciations for rhyming purposes. Verbly is now also a compiled library rather than being header-only due to the complexity of the query interface. --- progress.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 progress.h (limited to 'progress.h') diff --git a/progress.h b/progress.h new file mode 100644 index 0000000..81f07a3 --- /dev/null +++ b/progress.h @@ -0,0 +1,50 @@ +#ifndef PROGRESS_H_A34EF856 +#define PROGRESS_H_A34EF856 + +#include + +class progress { + private: + std::string message; + int total; + int cur = 0; + int lprint = 0; + + 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; + + std::cout << "\b\b\b\b" << std::right; + std::cout.width(3); + std::cout << pp << "%" << std::flush; + } + } + + void update() + { + update(cur+1); + } + + ~progress() + { + std::cout << "\b\b\b\b100%" << std::endl; + } +}; + +#endif /* end of include guard: PROGRESS_H_A34EF856 */ -- cgit 1.4.1