fix prevSize = 0

This commit is contained in:
François 2023-12-10 07:20:40 +01:00
parent 3e44eb5340
commit 73a00e3528
3 changed files with 9 additions and 1 deletions

View File

@ -9,10 +9,15 @@
using namespace std; using namespace std;
// ======================================== // ========================================
const int Context::prevSize (10); const int Context::prevSize (16);
const string Context::end (".?!"); const string Context::end (".?!");
const string Context::sep (" ,;-"); const string Context::sep (" ,;-");
int
Context::getPrevSize () {
return prevSize;
}
bool bool
Context::validChar (const char &c) { Context::validChar (const char &c) {
if (isalpha (c)) if (isalpha (c))

View File

@ -76,6 +76,8 @@ TextProdChar::prod (ostream &out, const long &size) {
if (maj) if (maj)
boost::to_upper (next); boost::to_upper (next);
out << next; out << next;
if (end && ! Context::getPrevSize ())
break;
if (context.isEnd (next) || if (context.isEnd (next) ||
(nl && context.isSep (next))) { (nl && context.isSep (next))) {
out << endl; out << endl;

View File

@ -20,6 +20,7 @@ class Context {
static const string end; static const string end;
static const string sep; static const string sep;
public: public:
static int getPrevSize ();
static bool validChar (const char &c); static bool validChar (const char &c);
static bool isEnd (const string &c); static bool isEnd (const string &c);
static bool isSep (const string &c); static bool isSep (const string &c);