Debian Codegraph @

src/phrase.h

raw symbols SCIP
1 /* phrase.h */
2 /* Copyright (C) 2015 Yves Ouvrard
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef PHRASE_H
19 #define PHRASE_H
20
21 #include <QList>
22 #include <QObject>
23 #include <QString>
24
25 #include <dialogue.h>
26 #include <flexfr.h>
27 #include <handicap.h>
28 #include <motflechi.h>
29 #include <regle.h>
30 #include <requete.h>
31 #include <semantique.h>
32
33 class Mot;
34
35 class Phrase: public QObject
36 {
37
38 Q_OBJECT
39
40 private:
41 QStringList entreMots;
42 QString _chAdditions;
43 QStringList _feminins;
44 QString _gr;
45 Flechisseur* _flechisseur;
46 QMap<QString,Handicap*> _handicaps;
47 int _imot;
48 Lemmat* _lemmatiseur;
49 QMap<QString, QStringList> _mapLgr;
50 QList<Mot*> _mots;
51 QString _num;
52 int _numReq;
53 QString _prae;
54 QList<Regle*> _regles;
55 QStringList _relect;
56 QString _reponse;
57 QList<Requete*> _requetes;
58 QString _tr;
59 bool _sem = false;
60 Semantique* _semantique;
61
62 bool enr();
63 void initFeminins ();
64 void initLgr();
65 void majAffichage(bool aux=false);
66 bool static sortR(Requete* ra, Requete* rb);
67
68 public:
69 Phrase(QString t="");
70 bool static accord(MotFlechi* ma, MotFlechi* mb, QString cgn);
71 void additions();
72 void ajRequete(Requete* req, bool force=false);
73 void annuleLemme(Mot* m, Lemme* l);
74 void choixFlechi(MotFlechi* mf);
75 void choixReq(Requete* req);
76 bool compatible(MotFlechi* mf, Mot* m);
77 bool compatible(MotFlechi* ma, MotFlechi* mb);
78 bool contigue(Requete* req);
79 bool contigus(Mot *a, Mot *b);
80 QString droite(Mot* m);
81 void ecoute(QString m);
82 bool estFeminin(QString n);
83 bool estVbRelative(MotFlechi* mf);
84 bool filtre(Requete* req);
85 Flechisseur* flechisseur();
86 QString gauche(Mot *m);
87 QString gr();
88 QString grLu();
89 int handicap(MotFlechi* mf);
90 QList<Requete*> homolexes(Requete* req);
91 QList<Requete*> homonymes(Requete* req);
92 QList<Requete*> homonymes(QString id);
93 QString htmlLiens();
94 QStringList lgr(char pos);
95 QStringList lgr(char pos, char posO);
96 bool isomorph(QString ma, QString mb);
97 void lemmatise();
98 QList<Requete*> lReqSub(MotFlechi* mf, bool closes=false);
99 QList<Requete*> lReqSup(MotFlechi* mf, bool closes=false);
100 Requete* montante(Mot* m);
101 Mot* motCourant();
102 Mot* motNo(int i);
103 int nbMots();
104 int nbPonct(QChar p, Mot* ma, Mot* mb);
105 int nbRegles();
106 int nbRequetes();
107 int nbSuper(MotFlechi* mf);
108 QString num();
109 int numNouvReq();
110 void nettoieHomonymes(QString id);
111 void peupleHandicap();
112 void peupleRegles(QString nf);
113 QList<Mot*> portee(int a, int b);
114 Regle* regle(int i);
115 Regle* regle(QString id);
116 void reinit();
117 QList<Requete*> reqCC(Mot* m);
118 Requete* requete(int n);
119 Requete* requete(QString codeR);
120 QString static saisie (QString l, QString s);
121 bool sem();
122 Semantique* semantique();
123 void setGr(QString t);
124 void setLiens();
125 QList<Mot*> supersDe(Mot* m);
126 QString tr(bool color = true);
127 MotFlechi* vbRelative(MotFlechi* mf);
128 signals:
129 void editTr(QString t);
130 void repondu(const QString);
131 public slots:
132 void traceReq();
133 };
134
135 namespace Chaines {
136
137 const QString titrePraelector =
138 "<h2 style=\"font-family:serif;\"><center>&#x2619; <a href=\"-aux\">PRAELECTOR</a> &#x2767;</center></h2>";
139
140 const QString menu = QString::fromUtf8
141 ("<a href=\"-par\">paramètres</a><br/>"
142 "<a href=\"-corpus\">choisir une phrase</a><br/>"
143 "<a href=\"-enr\">choisir une phrase enregistrée</a><br/>"
144 "<a href=\"-nouvPhr\">Saisir une phrase</a><br/>"
145 "<a href=\"-clav\">clavier</a> (touche '/')<br/>"
146 "taille <a href=\"-zoom\">+</a>&nbsp;<a href=\"-dezoom\">-</a>&nbsp;"
147 "<a href=\"-quitter\">quitter</a>");
148
149 const QString affichage = QString::fromUtf8
150 ("%1<hr/>%2<hr/>"
151 "<a href=\"-pprec\">phr. précédente</a>&nbsp;<a href=\"-psuiv\">suivante</a><br/>"
152 "<a href=\"-reinit\">réinitialiser</a>&nbsp;<a href=\"-init\">annuler</a><br/>"
153 "mot <a href=\"-prec\">précédent</a> <a href=\"-suiv\">suivant</a>&nbsp;"
154 "<a href=\"-trace\">enregistrer</a>"
155 "<hr/>%3"
156 "<hr/><strong>Morphologies et traductions du mot</strong><br/>\n%4"
157 "<hr/><strong>Liens syntaxiques</strong><br/>%5\n"
158 "<hr/><strong>état de la traduction</strong><br/>\n"
159 "<span style=\"color:darkred;\">%6</span>"
160 "<hr/>%7<br/><a href=\"-sem\">enrichissement de la base sémantique </a>");
161
162 const QString documentation = QString::fromUtf8
163 ("<div>On peut piloter Praelector à la souris, mais en saisissant "
164 "le caractère /, L'interface affiche en rouge des caractères "
165 "qui, saisis au clavier, activent le lien qui les suit.<br/>"
166 "Les liens <em>Reculer</em> et <em>Avancer</em> permettent "
167 "de se déplacer dans la phrase. Il est conseillé de faire "
168 "le plus de choix possibles avant de passer au mot suivant."
169 "On peut se déplacer de plusieurs mots en utilisant les "
170 "caractères de soulignement qui précèdent chaque mot déjà "
171 "lu. Parmi les choix, <ul>"
172 "<li> choix du déterminant ou du sujet ;"
173 "<li> choix ou édition de la traduction ; "
174 "<li> Rejet de la morphologie proposéë, ou validation "
175 "comme seule morphologie possible.</ul>"
176 "À partir du deuxième mot de la phrase, tous les "
177 "liens syntaxiques possibles sont proposés. On peut "
178 "rejeter ceux qui paraissent impossibles ou incorrects, "
179 "et valider ceux qu'on accepte. Souvent, plusieurs "
180 "liens concurrents sont possibles. Pour choisir, il "
181 "faut examiner avec soin la fonction des liens proposés, plus "
182 "que leur traduction, qui est souvent approximative. Des liens "
183 "permettent de choisir la traduction d'un mot, ou de l'éditer."
184 "L'état de la traduction est affiché au bas de la fenêtre.<br/>"
185 "Praelector est développé par Yves Ouvrard, et placé sous licence GPL."
186 "<em>Macte!</em></div>");
187
188 const QString affInit = QString::fromUtf8
189 ("Saisis ci-dessous la phrase à lire");
190
191 const QString ajTrEntree = QString::fromUtf8
192 ("Pour ajouter une entrée :\n "
193 "lemme;modèle;r1;r2;indMorph:tr1(comm.)[comm.],tr2;tr3\n"
194 "Pas d'espace avant les deux points ; le modèle peut être "
195 "donné par un numéro, ou par un mot du même modèle.\n");
196
197 /* déterminants */
198 const QStringList detMS = QStringList () <<"le" << "un";
199 const QStringList detFS = QStringList () <<"la" << "une";
200 const QStringList detP = QStringList () <<"les" << "des";
201
202 }
203
204 #endif