| 1 | /* requete.cpp */ |
| 2 | /* |
| 3 | * This file is part of PRAELECTOR. |
| 4 | * |
| 5 | * PRAELECTOR is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * COLLATINVS is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with PRAELECTOR; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | * |
| 19 | * © Yves Ouvrard, 2009 - 2017 |
| 20 | */ |
| 21 | |
| 22 | #include <requete.h> |
| 23 | |
| 24 | ////////////////////////////// |
| 25 | // Classe Requete // |
| 26 | ////////////////////////////// |
| 27 | |
| 28 | Requete::Requete(MotFlechi* sup, MotFlechi* sub, Regle* r) |
| 29 | { |
| 30 | // signetRequete |
| 31 | _regle = r; |
| 32 | _multi = _regle->filtre().contains("multi"); |
| 33 | _super = 0; |
| 34 | _sub = 0; |
| 35 | _rejetee = false; |
| 36 | _origine = 0; |
| 37 | if (sup != 0) |
| 38 | { |
| 39 | _super = sup; |
| 40 | _lemme = sup->lemme(); |
| 41 | _morpho = sup->morpho(); |
| 42 | _phrase = sup->mot()->phrase(); |
| 43 | _subRequis = true; |
| 44 | } |
| 45 | if (sub != 0) |
| 46 | { |
| 47 | _sub = sub; |
| 48 | _lemme = sub->lemme(); |
| 49 | _morpho = sub->morpho(); |
| 50 | _phrase = sub->mot()->phrase(); |
| 51 | _subRequis = false; |
| 52 | } |
| 53 | _num = _phrase->numNouvReq(); |
| 54 | if (_super == 0) _requerant = _sub->mot(); |
| 55 | else if (_sub == 0) _requerant = _super->mot(); |
| 56 | _coord1 = 0; |
| 57 | _valide = false; |
| 58 | _itr = 0; |
| 59 | ajHist("Requête num "+numc()+" "+doc()); |
| 60 | } |
| 61 | |
| 62 | Requete::~Requete() |
| 63 | { |
| 64 | _hist.clear(); |
| 65 | } |
| 66 | |
| 67 | QString Requete::aff() |
| 68 | { |
| 69 | return _regle->aff(); |
| 70 | } |
| 71 | |
| 72 | void Requete::ajHist(QString h) |
| 73 | { |
| 74 | _hist.append(h); |
| 75 | } |
| 76 | |
| 77 | void Requete::annuleRequis(QString cause) |
| 78 | { |
| 79 | if (!close()) |
| 80 | { |
| 81 | ajHist("Erreur - Requête déjà annulée"); |
| 82 | return; |
| 83 | } |
| 84 | setRequis(0, cause); |
| 85 | ajHist("ANNULÉE "+cause); |
| 86 | } |
| 87 | |
| 88 | Requete* Requete::clone() |
| 89 | { |
| 90 | Requete* nreq; |
| 91 | if (!close()) |
| 92 | { |
| 93 | if (_subRequis) nreq = new Requete(_super, 0, _regle); |
| 94 | else nreq = new Requete(0, _sub, _regle); |
| 95 | } |
| 96 | else |
| 97 | { |
| 98 | nreq = new Requete(_super, _sub, _regle); |
| 99 | } |
| 100 | if (_subRequis) nreq->setSubRequis(); |
| 101 | else nreq->setSuperRequis(); |
| 102 | if (_origine != 0) nreq->setOrigine(_origine); |
| 103 | else nreq->setOrigine(this); |
| 104 | return nreq; |
| 105 | } |
| 106 | |
| 107 | bool Requete::clonee() |
| 108 | { |
| 109 | return _origine != 0; |
| 110 | } |
| 111 | |
| 112 | int Requete::cloneeDe() |
| 113 | { |
| 114 | if (_origine == 0) return -1; |
| 115 | return _origine->num(); |
| 116 | } |
| 117 | |
| 118 | bool Requete::close() |
| 119 | { |
| 120 | return (_super != 0 && _sub != 0); |
| 121 | } |
| 122 | |
| 123 | QString Requete::code() |
| 124 | { |
| 125 | QString ret; |
| 126 | QTextStream fl(&ret); |
| 127 | fl << _super->mot()->rang() |
| 128 | << "-" << _super->num() |
| 129 | << "-" << id() |
| 130 | << "-" << _sub->mot()->rang() |
| 131 | << "-" << _sub->num(); |
| 132 | return ret; |
| 133 | } |
| 134 | |
| 135 | bool Requete::contigue() |
| 136 | { |
| 137 | if (!close()) return false; |
| 138 | return abs(_super->rang() - _sub->rang()) == 1; |
| 139 | } |
| 140 | |
| 141 | Requete* Requete::coord1() |
| 142 | { |
| 143 | return _coord1; |
| 144 | } |
| 145 | |
| 146 | bool Requete::croise(Requete* req) |
| 147 | { |
| 148 | if (!close() || !req->close()) return false; |
| 149 | int prim = prima()->rang(); |
| 150 | int ult = ultima()->rang(); |
| 151 | int reqprim = req->prima()->rang(); |
| 152 | int reqult = req->ultima()->rang(); |
| 153 | //if (req->aff()=="coord1") ++reqult; |
| 154 | if (prim < reqprim && ult > reqprim && ult < reqult) |
| 155 | return true; |
| 156 | if (prim > reqprim && prim < reqult && ult > reqult) |
| 157 | return true; |
| 158 | return false; |
| 159 | } |
| 160 | |
| 161 | bool Requete::homonyme(Requete* req) |
| 162 | { |
| 163 | return id() == req->id() |
| 164 | && _super->mot() == req->super()->mot() |
| 165 | && _sub->mot() == req->sub()->mot(); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * rang du requis - rang du requérant |
| 170 | * la virgule accroît le résultat de 5 |
| 171 | * à modifier : distance en groupes, non en mots. |
| 172 | */ |
| 173 | int Requete::distance() |
| 174 | { |
| 175 | if (!close()) return 100; |
| 176 | int ret = requis()->rang() - requerant()->rang(); |
| 177 | // une seule virgule est un handicap |
| 178 | int nbp = nbPonct(','); |
| 179 | if (id() == "app" && nbp == 1) ret = 0; |
| 180 | else ret += 20; |
| 181 | return ret; |
| 182 | } |
| 183 | |
| 184 | int Requete::distance(Mot* m) |
| 185 | { |
| 186 | if (m != 0) return m->rang() - _requerant->rang(); |
| 187 | return _phrase->nbMots(); |
| 188 | } |
| 189 | |
| 190 | QString Requete::doc() |
| 191 | { |
| 192 | QString ret; |
| 193 | QTextStream fl(&ret); |
| 194 | fl<<_num<<". "; |
| 195 | if (_subRequis) fl<<"subRequis "; |
| 196 | else fl<<"superRequis "; |
| 197 | if (_super == 0) fl << "?"; |
| 198 | else fl << _super->mot()->gr()<<" "<<_super->lemme()->gr()<<" "<<_super->morpho(); |
| 199 | fl << "-" <<id() <<"->"; |
| 200 | if (_sub == 0) fl << "?"; |
| 201 | else fl << _sub->mot()->gr()<<" "<<_sub->lemme()->gr()<<" "<<_sub->morpho(); |
| 202 | if (_origine != 0) fl << " clone de "<<_origine->num(); |
| 203 | if (_rejetee) fl << "\nrejetée"; |
| 204 | if (_valide) fl<<"\ntraduction:"<<tr(); |
| 205 | return ret; |
| 206 | } |
| 207 | |
| 208 | bool Requete::egale(Requete* req) |
| 209 | { |
| 210 | if ( (req->regle() != _regle) |
| 211 | || (req->sub() != _sub) |
| 212 | || (req->subRequis() != _subRequis) |
| 213 | || (req->super() != _super)) return false; |
| 214 | return true; |
| 215 | } |
| 216 | |
| 217 | bool Requete::enConflit(QString id) |
| 218 | { |
| 219 | return _regle->conflit(id); |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * \fn bool Requete::exclut(Requete* req) |
| 224 | * \brief application de la propriété x:<id> de Regle |
| 225 | */ |
| 226 | bool Requete::exclut(Requete* req) |
| 227 | { |
| 228 | if (!close()) return false; |
| 229 | if (!req->close()) return false; |
| 230 | if (_super != req->super()) return false; |
| 231 | if (_sub != req->sub()) return false; |
| 232 | if (_regle->exclut(req->regle()->id())) return true; |
| 233 | return false; |
| 234 | } |
| 235 | |
| 236 | QString Requete::fonction() |
| 237 | { |
| 238 | QString ret; |
| 239 | QTextStream fl(&ret); |
| 240 | fl<< _sub->gr()<<" "<<_sub->pos()<<" "<<_regle->aff()<<" "<<_super->gr()<<" "<<_super->pos(); |
| 241 | return ret; |
| 242 | } |
| 243 | |
| 244 | int Requete::freq() |
| 245 | { |
| 246 | return _super->freq() + _sub->freq(); |
| 247 | } |
| 248 | |
| 249 | QString Requete::gv(QString format) |
| 250 | { |
| 251 | QString lin; |
| 252 | QTextStream flin(&lin); |
| 253 | if (format == "dot") |
| 254 | { |
| 255 | if (!close()) |
| 256 | { |
| 257 | //if (_subRequis) flin << "/* "<<_requerant->gr()<<"-"<<id()<<"->? */"; |
| 258 | if (_subRequis) flin << "/* "<<_requerant->gr()<<"-"<<aff()<<"->? */"; |
| 259 | else flin << "/* ? -"<<aff()<<"->"<<_requerant->gr()<<" */"; |
| 260 | } |
| 261 | else flin << "N"<<_super->rang()<<"->N"<<_sub->rang() |
| 262 | << " [label=\""<<aff()<<"\"];"; |
| 263 | } |
| 264 | else if (format=="easy") |
| 265 | { |
| 266 | if (!close()) |
| 267 | { |
| 268 | if (_subRequis) flin << "# "<<_requerant->gr()<<"-"<<aff()<<"->? "; |
| 269 | else flin << "# ? -"<<aff()<<"->"<<_requerant->gr(); |
| 270 | } |
| 271 | else flin << "["<<_super->rang()<<" "<<_super->gr()<<"] -- "<<aff()<<" --> ["<<_sub->rang()<<" "<<_sub->gr()<<"]"; |
| 272 | } |
| 273 | return lin; |
| 274 | } |
| 275 | |
| 276 | int Requete::handicap() |
| 277 | { |
| 278 | if (!close()) return 500; |
| 279 | // possum n'admet pas les noms et pronoms objet |
| 280 | if (_super->lemme()->gr() == "possum" && id() == "objet" |
| 281 | && (_sub->lemme()->pos() == "n" || _sub->lemme()->pos() == "p")) |
| 282 | return 50; |
| 283 | // somme des handicaps des noeuds |
| 284 | int ret = _super->handicap() + _sub->handicap(); |
| 285 | // une virgule est un gros handicap |
| 286 | if (id() != "app" && id() != "conjSub" && nbPonct(',') > 0) ret += 40; |
| 287 | // un génitif est rarement super d'un autre génitif |
| 288 | if (id() == "genitif" && _super->morpho().contains("génitif")) |
| 289 | ret += 7; |
| 290 | if (_regle->id() == "epithete" && _sub->mot()->nomAdj() && !contigue()) |
| 291 | ret += 10; |
| 292 | return ret; |
| 293 | } |
| 294 | |
| 295 | QString Requete::hist() |
| 296 | { |
| 297 | if (_valide) _hist.append("tr.:"+tr()); |
| 298 | return _hist.join("\n"); |
| 299 | } |
| 300 | |
| 301 | bool Requete::homoSub(MotFlechi* mf) |
| 302 | { |
| 303 | return _sub->mot() == mf->mot(); |
| 304 | } |
| 305 | |
| 306 | QString Requete::html(bool enr) |
| 307 | { |
| 308 | if (!close()) return doc(); |
| 309 | QString ret; |
| 310 | QTextStream fl(&ret); |
| 311 | QString color; |
| 312 | if (_valide) color = "darkred"; |
| 313 | else color = "black"; |
| 314 | if (enr) fl << "<div style=\"background-color:lightyellow;\">"; |
| 315 | else fl << "<div>"; |
| 316 | QString codeR = code(); |
| 317 | fl << _sub->gr()<<"<small> " << _sub->morpho() << " </small>" |
| 318 | // en vert, aff de la règle |
| 319 | << "<span style=\"color:green;\">"<<_regle->aff()<<"</span> " |
| 320 | << _super->gr() <<"<small> " << _super->morpho() << " </small>" |
| 321 | // En ocre italique, traduction |
| 322 | << "<span style=\"color:"<<color<<";font-style:italic\">" |
| 323 | <<MotFlechi::elideFr(_super->trGroupe(this))<<"</span> " |
| 324 | // doc de la règle |
| 325 | << "<a href=\"l.i."<<codeR<<"\">doc</a> " |
| 326 | // rotation de la traduction |
| 327 | << "<a href=\"l.t."<<codeR<<"\">tr. suiv</a> " |
| 328 | // lien valider |
| 329 | << "<a href=\"l.v."<<codeR<<"\">valider</a> " |
| 330 | // lien rejeter |
| 331 | << "<a href=\"l.r."<<codeR<<"\">rejeter</a>"; |
| 332 | fl << "</div>"; |
| 333 | return ret; |
| 334 | } |
| 335 | |
| 336 | QString Requete::humain(bool num) |
| 337 | { |
| 338 | QString ret; |
| 339 | QTextStream fl(&ret); |
| 340 | if (num) fl << _num <<". "; |
| 341 | if (_super == 0) |
| 342 | fl << "?"; |
| 343 | else fl << _super->lemme()->gr(); |
| 344 | fl << " "<<id()<<" "; |
| 345 | if (_sub == 0) |
| 346 | fl << "?"; |
| 347 | else fl << _sub->gr(); |
| 348 | return ret; |
| 349 | } |
| 350 | |
| 351 | bool Requete::homoSuper(MotFlechi* mf) |
| 352 | { |
| 353 | return _super->mot() == mf->mot(); |
| 354 | } |
| 355 | |
| 356 | QString Requete::id() |
| 357 | { |
| 358 | return _regle->id(); |
| 359 | } |
| 360 | |
| 361 | void Requete::incItr() |
| 362 | { |
| 363 | ++_itr; |
| 364 | if (_itr >= _regle->nbTr()) |
| 365 | _itr = 0; |
| 366 | } |
| 367 | |
| 368 | int Requete::largeur() |
| 369 | { |
| 370 | if (!close()) return 1000; |
| 371 | return abs(_super->rang() - _sub->rang()); |
| 372 | } |
| 373 | |
| 374 | /* |
| 375 | QString Requete::lemMorph() |
| 376 | { |
| 377 | if (!close()) return ""; |
| 378 | QString ret; |
| 379 | QTextStream(&ret) |
| 380 | << _super->lemme()->gr()<<","<<_super->morpho()<<"-" |
| 381 | << _sub->lemme()->gr()<<","<<_sub->morpho(); |
| 382 | return ret; |
| 383 | } |
| 384 | */ |
| 385 | |
| 386 | bool Requete::multi() |
| 387 | { |
| 388 | return _multi; |
| 389 | } |
| 390 | |
| 391 | int Requete::nbPonct(QChar c) |
| 392 | { |
| 393 | if (!close()) return 0; |
| 394 | return _requerant->phrase()->nbPonct(c, _requerant, requis()); |
| 395 | } |
| 396 | |
| 397 | int Requete::num() |
| 398 | { |
| 399 | return _num; |
| 400 | } |
| 401 | |
| 402 | QString Requete::numc() |
| 403 | { |
| 404 | return QString::number(_num); |
| 405 | } |
| 406 | |
| 407 | Requete* Requete::origine() |
| 408 | { |
| 409 | return _origine; |
| 410 | } |
| 411 | |
| 412 | int Requete::poids() |
| 413 | { |
| 414 | int ret = _regle->poids(); |
| 415 | if (!close()) return ret; |
| 416 | ret -= handicap(); |
| 417 | if (contigue()) ret += _regle->contig(); |
| 418 | if (_sub->rang() < _super->rang()) ret += _regle->antepos(); |
| 419 | // si le requis de la requête est le dernier mot, et que l'annulation |
| 420 | // laisserait le requérant isolé |
| 421 | if (requisFl()->rang() == _phrase->nbMots()-1 && requerantFl()->nbCloses() == 1) |
| 422 | ret += 20; |
| 423 | return ret; |
| 424 | } |
| 425 | |
| 426 | QList<Mot*> Requete::portee() |
| 427 | { |
| 428 | QList<Mot*> liste; |
| 429 | for (int i=prima()->rang()+1;i<ultima()->rang();++i) |
| 430 | liste.append( _phrase->motNo(i)); |
| 431 | return liste; |
| 432 | } |
| 433 | |
| 434 | MotFlechi* Requete::prima() |
| 435 | { |
| 436 | if (!close()) return requerantFl(); |
| 437 | if (_super->rang() < _sub->rang()) return _super; |
| 438 | return _sub; |
| 439 | } |
| 440 | |
| 441 | bool Requete::reciproque(Requete* req) |
| 442 | { |
| 443 | return _super == req->sub() && _sub == req->super(); |
| 444 | } |
| 445 | |
| 446 | bool Requete::rejetee() |
| 447 | { |
| 448 | return _rejetee; |
| 449 | } |
| 450 | |
| 451 | Regle* Requete::regle() |
| 452 | { |
| 453 | return _regle; |
| 454 | } |
| 455 | |
| 456 | Mot* Requete::requerant() |
| 457 | { |
| 458 | return _requerant; |
| 459 | } |
| 460 | |
| 461 | MotFlechi* Requete::requerantFl() |
| 462 | { |
| 463 | if (_subRequis) return _super; |
| 464 | return _sub; |
| 465 | } |
| 466 | |
| 467 | Mot* Requete::requis() |
| 468 | { |
| 469 | if (!close()) return 0; |
| 470 | if (_requerant == _super->mot()) return _sub->mot(); |
| 471 | return _super->mot(); |
| 472 | } |
| 473 | |
| 474 | MotFlechi* Requete::requisFl() |
| 475 | { |
| 476 | if (!close()) return 0; |
| 477 | if (_subRequis) return _sub; |
| 478 | return _super; |
| 479 | } |
| 480 | |
| 481 | QChar Requete::sens() |
| 482 | { |
| 483 | return _regle->sens(); |
| 484 | } |
| 485 | |
| 486 | bool Requete::separeparVConj() |
| 487 | { |
| 488 | if (!close()) return false; |
| 489 | //QList<Mot*> mots = _phrase->portee(_requerant->rang(), requis()->rang()); |
| 490 | QList<Mot*> mots = portee(); |
| 491 | if (mots.empty()) return false; |
| 492 | bool v = true; |
| 493 | for (int i=0;i<mots.count();++i) |
| 494 | { |
| 495 | Mot* m = mots.at(i); |
| 496 | for (int im=0;im<m->nbFlechis();++im) |
| 497 | { |
| 498 | MotFlechi* mf = m->flechi(im); |
| 499 | v = v || (mf->lemme()->pos().contains('w') |
| 500 | && mf->morpho().contains("è")); |
| 501 | } |
| 502 | } |
| 503 | return v; |
| 504 | } |
| 505 | |
| 506 | void Requete::setCoord1(Requete* req) |
| 507 | { |
| 508 | _coord1 = req; |
| 509 | } |
| 510 | |
| 511 | void Requete::setOrigine(Requete* req) |
| 512 | { |
| 513 | _origine = req; |
| 514 | } |
| 515 | |
| 516 | void Requete::setRejetee(bool r, QString cause) |
| 517 | { |
| 518 | _rejetee = r; |
| 519 | if (r) _hist.append("rejetée "+cause); |
| 520 | else _hist.append("rejet annulé "+cause); |
| 521 | } |
| 522 | |
| 523 | void Requete::setRequis(MotFlechi *m, QString cause) |
| 524 | { |
| 525 | bool nul = m == 0; |
| 526 | if (_subRequis) |
| 527 | { |
| 528 | if (nul) _sub = 0; |
| 529 | else setSub(m); |
| 530 | } |
| 531 | else |
| 532 | { |
| 533 | if (nul) _super = 0; |
| 534 | else setSuper(m); |
| 535 | } |
| 536 | if (nul) ajHist("ANNULATION du requis, "+cause); |
| 537 | else |
| 538 | { |
| 539 | ajHist("REQUIS adopté ("+cause+") "+m->gr()+", "+m->morpho()); |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | void Requete::setSub(MotFlechi *m) |
| 544 | { |
| 545 | _sub = m; |
| 546 | //_sub->ajReq(this); |
| 547 | } |
| 548 | |
| 549 | void Requete::setSubRequis() |
| 550 | { |
| 551 | _subRequis = true; |
| 552 | } |
| 553 | |
| 554 | void Requete::setSuper(MotFlechi *m) |
| 555 | { |
| 556 | _super = m; |
| 557 | //_super->ajReq(this); |
| 558 | } |
| 559 | |
| 560 | void Requete::setSuperRequis() |
| 561 | { |
| 562 | _subRequis = false; |
| 563 | } |
| 564 | |
| 565 | void Requete::setValide(bool v) |
| 566 | { |
| 567 | _valide = v; |
| 568 | if (v) |
| 569 | { |
| 570 | // négation |
| 571 | if (_sub->lemme()->synt("neg") && QString("wv").contains(_super->pos())) |
| 572 | { |
| 573 | _super->setNeg(true); |
| 574 | } |
| 575 | if (_super->gr() == "nisi" && QString("wv").contains(_sub->pos())) |
| 576 | { |
| 577 | _sub->setNeg(true); |
| 578 | } |
| 579 | // base synt et ontologie |
| 580 | if (_phrase->sem()) |
| 581 | _phrase->semantique()->ajLien(triple()); |
| 582 | ajHist("VALIDÉE\n"+doc()); |
| 583 | } |
| 584 | else |
| 585 | { |
| 586 | // négation |
| 587 | if (_regle->lsSub("neg")) |
| 588 | { |
| 589 | _super->setNeg(false); |
| 590 | } |
| 591 | ajHist("INVALIDÉE"); |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | MotFlechi* Requete::sub() |
| 596 | { |
| 597 | return _sub; |
| 598 | } |
| 599 | |
| 600 | bool Requete::subRequis() |
| 601 | { |
| 602 | return _subRequis; |
| 603 | } |
| 604 | |
| 605 | // dans la traduction choisie, <sub> est-il avant <sup> ? |
| 606 | bool Requete::subSup() |
| 607 | { |
| 608 | QString tr = _regle->tr(_itr); |
| 609 | if (tr.indexOf("<sub>") < tr.indexOf("<sup>")) |
| 610 | return true; |
| 611 | return false; |
| 612 | } |
| 613 | |
| 614 | MotFlechi* Requete::super() |
| 615 | { |
| 616 | return _super; |
| 617 | } |
| 618 | |
| 619 | bool Requete::superRequis() |
| 620 | { |
| 621 | return !_subRequis; |
| 622 | } |
| 623 | |
| 624 | QString Requete::tr() |
| 625 | { |
| 626 | QString ret = _regle->tr(); |
| 627 | if (_super != 0) ret.replace("<sup>", _super->tr()); |
| 628 | if (_sub != 0) ret.replace("<sub>", _sub->trGroupe()); |
| 629 | return ret; |
| 630 | } |
| 631 | |
| 632 | /** |
| 633 | * \fn QString Requete::triple() |
| 634 | * \brief fournit un enregistrement pour la base sémantique |
| 635 | */ |
| 636 | QString Requete::triple() |
| 637 | { |
| 638 | if (!_valide) return "triple(), erreur"; |
| 639 | return QString("%1;%2;%3") |
| 640 | .arg(_sub->lemme()->cle()) |
| 641 | .arg(_regle->aff()) |
| 642 | .arg(_super->lemme()->cle()); |
| 643 | } |
| 644 | |
| 645 | QString Requete::trSub() |
| 646 | { |
| 647 | if (_sub == 0) return "erreur, sub manquant"; |
| 648 | QString ret = _regle->tr(_itr); |
| 649 | ret.remove("<sup>"); |
| 650 | // correction de morpho fr |
| 651 | /* |
| 652 | if (id()=="propInf") |
| 653 | { |
| 654 | QString morph; |
| 655 | morph = _sub->morpho(); |
| 656 | morph.replace("infinitif", "indicatif"); |
| 657 | morph.append(" 3ème singulier"); |
| 658 | _sub->calcTr(morph); |
| 659 | } |
| 660 | */ |
| 661 | ret.replace("<sub>", _sub->trGroupe()); |
| 662 | return ret; |
| 663 | } |
| 664 | |
| 665 | MotFlechi* Requete::ultima() |
| 666 | { |
| 667 | if (!close()) return requerantFl(); |
| 668 | if (_super->rang() > _sub->rang()) return _super; |
| 669 | return _sub; |
| 670 | } |
| 671 | |
| 672 | bool Requete::valide() |
| 673 | { |
| 674 | return _valide; |
| 675 | } |