├── .gitignore ├── .gitmodules ├── images └── svg │ ├── license.txt │ ├── abacus.svg │ ├── dicolitt.svg │ ├── noun_project_94-power.svg │ ├── dicolem.svg │ ├── help-browser.svg │ ├── edit-alpha.svg │ ├── system-search.svg │ ├── document-new.svg │ ├── edit-clear.svg │ └── folder-open.svg ├── collatinus.qrc ├── collatinus.pro ├── src ├── maj.h ├── lewis.h ├── main.h ├── syntaxe.h ├── maj.cpp ├── libcollatinus.h ├── lewis.cpp └── syntaxe.cpp └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ressources"] 2 | path = ressources 3 | url = https://github.com/biblissima/collatinus-data.git 4 | -------------------------------------------------------------------------------- /images/svg/license.txt: -------------------------------------------------------------------------------- 1 | # the following are icon comming with this project are part of the tango 2 | # desktop project http://tango.freedesktop.org/ or derivate from it, and are 3 | # release to the public domain. 4 | 5 | document-new.svg 6 | document-open.svg 7 | document-save-as.svg 8 | document-save.svg 9 | edit-clear.svg 10 | edit-delete.svg 11 | edit-find-replace.svg 12 | edit-find.svg 13 | folder-open.svg 14 | folder-saved-search.svg 15 | help-browser.svg 16 | system-search.svg 17 | 18 | # those are derivate work 19 | Format-text-size-decrease.svg 20 | Format-text-size-incease.svg 21 | 22 | # this icon is derivative from the Noun Project 23 | # (http://www.thenounproject.com/) 24 | # and is in public domain 25 | noun_project_94-power.svg 26 | 27 | # those last 3 have been created for the project 28 | # (put license here) 29 | edit-alpha.svg 30 | gear.svg 31 | syntaxe.svg 32 | -------------------------------------------------------------------------------- /collatinus.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/svg/edit-alpha.svg 4 | images/svg/edit-clear.svg 5 | images/svg/noun_project_94-power.svg 6 | images/svg/edit-find.svg 7 | images/svg/Format-text-size-increase.svg 8 | images/svg/Format-text-size-decrease.svg 9 | images/svg/help-browser.svg 10 | images/svg/gear.svg 11 | images/svg/document-new.svg 12 | images/svg/document-open.svg 13 | images/svg/document-save-as.svg 14 | images/svg/syntaxe.svg 15 | images/svg/edit-clear.svg 16 | images/svg/document-new.svg 17 | images/svg/document-save.svg 18 | images/svg/edit-alpha.svg 19 | images/svg/edit-clear.svg 20 | images/svg/edit-delete.svg 21 | images/svg/edit-find-replace.svg 22 | images/svg/folder-open.svg 23 | images/svg/folder-saved-search.svg 24 | images/svg/system-search.svg 25 | images/svg/syntaxe.svg 26 | images/svg/gear.svg 27 | images/svg/Format-text-size-increase.svg 28 | images/svg/Format-text-size-decrease.svg 29 | images/svg/help-browser.svg 30 | images/svg/noun_project_94-power.svg 31 | images/svg/abacus.svg 32 | images/svg/dicolem.svg 33 | images/svg/dicolitt.svg 34 | 35 | 36 | -------------------------------------------------------------------------------- /collatinus.pro: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Automatically generated by qmake (2.01a) mer. nov. 1 14:52:27 2006 3 | # And modify manually 4 | ###################################################################### 5 | 6 | TEMPLATE = app 7 | TARGET = collatinus 8 | VERSION = "10.2" 9 | DEFINES += VERSION=\\\"$$VERSION\\\" 10 | DEPENDPATH += . 11 | INCLUDEPATH += . 12 | # TRANSLATIONS = collatinus_en.ts collatinus_la.ts collatinus_fr.ts 13 | 14 | OBJECTS_DIR= obj/ 15 | MOC_DIR = moc/ 16 | 17 | # Input 18 | HEADERS += src/*.h 19 | FORMS += src/*.ui 20 | SOURCES += src/*.cpp #src/*.cc 21 | RESOURCES += collatinus.qrc 22 | QT += svg 23 | QT += xmlpatterns 24 | CONFIG += release_binary 25 | 26 | TRANSLATIONS = collatinus_fr.ts \ 27 | collatinus_en.ts \ 28 | 29 | macx{ 30 | TARGET = Collatinus 31 | #note mac os x, fair un $ qmake -spec macx-g++ 32 | #CONFIG += x86 ppc 33 | QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 34 | ICON = MacOS/collatinus.icns 35 | #QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.4u.sdk 36 | 37 | #QMAKE_POST_LINK=strip Collatinus.app/Contents/MacOS/collatinus 38 | 39 | # install into app bundle 40 | # à changer en ressources 41 | data.path = Collatinus.app/Contents/MacOS 42 | data.files = ressources/* 43 | deploy.depends = install_documentation 44 | deploy.depends += install 45 | documentation.path = Collatinus.app/Contents/MacOS/doc/ 46 | documentation.files = doc/*.html doc/*.css 47 | # ajouter un cible qui fait macdeploy Collatinus.app 48 | deploy.commands = macdeployqt Collatinus.app 49 | dmg.depends = deploy 50 | dmg.commands = ./MacOS/Collatinus.sh 51 | INSTALLS += documentation 52 | # INSTALLS += data 53 | QMAKE_EXTRA_TARGETS += deploy 54 | QMAKE_EXTRA_TARGETS += dmg 55 | } 56 | unix:!macx{ 57 | target.path = /usr/bin 58 | target.target = collatinus 59 | install.files = ressources/lemmata.* ressources/lucretia.txt ressources/expressions.fr 60 | install.path = /usr/share/collatinus9 61 | documentation.path = /usr/share/collatinus9/doc 62 | documentation.files = doc/*.html 63 | 64 | INSTALLS += target 65 | INSTALLS += install 66 | INSTALLS += documentation 67 | } 68 | -------------------------------------------------------------------------------- /images/svg/abacus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 39 | 41 | 42 | 44 | image/svg+xml 45 | 47 | 48 | 49 | 50 | 51 | 56 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/maj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * maj.h 3 | * 4 | * This file is part of COLLATINVS. 5 | * 6 | * COLLATINVS is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * COLLATINVS is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with COLLATINVS; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef MAJ_H 22 | #define MAJ_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #if QT_VERSION >= 0x050000 // Philippe travaille avec Qt5 sur Mac et a besoin de ces 3 lignes !!! 33 | #include 34 | #endif 35 | 36 | QString const urlDepot = "http://outils.biblissima.fr/collatinus/"; 37 | 38 | typedef QList ListeF; 39 | 40 | class HttpWindow: public QDialog 41 | { 42 | Q_OBJECT 43 | public: 44 | HttpWindow (QWidget *parent = 0); 45 | void append(const QUrl &url); 46 | void append(const QStringList &urlList); 47 | QString saveFileName(const QUrl &url); 48 | 49 | signals: 50 | void finished(); 51 | 52 | private slots: 53 | void startNextDownload(); 54 | void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); 55 | void downloadFinished(); 56 | void downloadReadyRead(); 57 | void telecharger (); 58 | 59 | private: 60 | void setupUi(QDialog *Dialog); 61 | // widgets 62 | QString depot; 63 | QVBoxLayout *verticalLayout; 64 | QLabel *urlLabel; 65 | QPushButton *boutonTelech; 66 | QDialogButtonBox *buttonBox; 67 | QLabel *label; 68 | QProgressDialog *progressDialog; 69 | // téléchargement 70 | QNetworkAccessManager manager; 71 | QQueue downloadQueue; 72 | QNetworkReply *currentDownload; 73 | QFile output; 74 | // QTime downloadTime; 75 | // variables 76 | QString repRes; 77 | QString repDic; 78 | bool finis; 79 | int downloadedCount; 80 | int totalCount; 81 | bool httpRequestAborted; 82 | // affichage des fichiers à télécharger 83 | QStringList suffIdxCfg; 84 | QStringList suffDic; 85 | ListeF ls (QString d); // établit la liste les fichiers locaux 86 | QList lcb; // liste des combos 87 | QStringList invis; // liste des satellites 88 | void peupleCombos (); 89 | }; 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /images/svg/dicolitt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 39 | 41 | 42 | 44 | image/svg+xml 45 | 47 | 48 | 49 | 50 | 51 | 56 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/lewis.h: -------------------------------------------------------------------------------- 1 | /* lewis.h 2 | * 3 | * This file is part of COLLATINVS. 4 | * 5 | * COLLATINVS 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 COLLATINVS; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #ifndef LEWIS_H 22 | #define LEWIS_H 23 | #include 24 | 25 | typedef QPair pairL; 26 | typedef QList llew; 27 | 28 | class Dictionnaire: public QObject 29 | { 30 | Q_OBJECT 31 | 32 | private: 33 | QString n; // nom 34 | QString repertoire; 35 | QString chData; // chemin complet du fichier djvu ou xml 36 | bool xml; 37 | bool djvu; 38 | QString auteur; 39 | QString url; 40 | int debut; 41 | QStringList idxDjvu; 42 | QString idxJv; // chemin de l'index jv 43 | QString cond_jv; 44 | bool ji; 45 | bool JI; 46 | bool xsl; 47 | QString prec; // pages précédente et suivante 48 | QString suiv; 49 | int pdj; 50 | bool jv; 51 | QStringList liens; 52 | QString ligneLiens; 53 | QString echelle; // échelle pour l'extraction d'une image d'un djvu 54 | public: 55 | Dictionnaire (QString cfg); 56 | QString nom (); 57 | void vide_index (); 58 | void vide_ligneLiens (); 59 | bool lis_index_djvu (); 60 | QString convert (QString source); 61 | QString entree_pos (qint64 pos); 62 | QString page (QStringList req, int no=0); // lien si la requête vient d'un hyperlien djvu 63 | QString pageXml (QStringList req); 64 | QString pageDjvu (int p); 65 | QString pageDjvu (QStringList req, int no=0); // surcharge avec calcul des no de page 66 | int noPageDjvu (); 67 | QString pgPrec (); 68 | QString pgSuiv (); 69 | bool estXml (); 70 | QString indexJv (); 71 | QString indexIu (); 72 | QStringList links (); // renvoie liens 73 | QString ramise (QString f); 74 | }; 75 | 76 | class ListeDic: public QObject 77 | { 78 | Q_OBJECT 79 | 80 | private: 81 | QMultiMap liste; 82 | Dictionnaire * currens; 83 | 84 | public: 85 | Dictionnaire * dictionnaire_par_nom (QString nom); 86 | void ajoute (Dictionnaire *d); 87 | void change_courant (QString nom); 88 | Dictionnaire * courant (); 89 | // page renvoie le code html de la page 90 | // du dictionnaire courant 91 | // correspondant au lemme l. 92 | }; 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Collatinus 2 | 3 | Ce dépôt contient les sources de [Collatinus](http://outils.biblissima.fr/collatinus/), un logiciel libre et gratuit pour la **lemmatisation et l'analyse morphologique de textes latins**. 4 | 5 | Collatinus est développé par Yves Ouvrard et Philippe Verkerk. 6 | 7 | **Page de présentation et téléchargement sur le site Biblissima** : [http://outils.biblissima.fr/collatinus/](http://outils.biblissima.fr/collatinus/) (exécutables disponibles pour Mac OS, GNU/Linux et Windows). 8 | 9 | Collatinus existe aussi en **version web** : 10 | - Démo sur le site Biblissima : [http://outils.biblissima.fr/collatinus-web/](http://outils.biblissima.fr/collatinus-web) 11 | - Collatinus-web sur Github : [collatinus-web-daemon](https://github.com/biblissima/collatinus-web-daemon) et [collatinus-web-ui](https://github.com/biblissima/collatinus-web-ui) 12 | 13 | ### Principales fonctionnalités 14 | 15 | - lemmatisation de mots latins ou d'un texte latin entier, 16 | - traduction des lemmes grâce aux dictionnaires de latin incorporés dans l'application, 17 | - affichage des quantités (durée longue ou brève des syllabes) et des flexions (déclinaison ou conjugaison). 18 | 19 | ## Installation 20 | 21 | Collatinus a été écrit avec **Qt**. Le fichier du projet Qt, `collatinus.pro`, devra probablement être adapté à l'environnement local. Nous le donnons ici à titre d'exemple (peut-être même qu'il fonctionnera). 22 | 23 | ### Ajout des données 24 | 25 | Pour que le programme Collatinus fonctionne, il faut lui fournir des **fichiers de données**. Ces fichiers sont rangés dans un répertoire `ressources/` que l'on trouvera dans le dépôt Github [collatinus-data](https://github.com/biblissima/collatinus-data). Les fichiers volumineux des dictionnaires (*.xml ou *.djvu) ne sont pas inclus dans le dépôt : ils doivent être téléchargés directement depuis la page Collatinus du site Biblissima (section Téléchargements : http://outils.biblissima.fr/collatinus/#telechargements) 26 | 27 | Selon le système d'exploitation utilisé, le dossier `ressources/` devra être rangé à un endroit précis. Pour Windows et Linux, il doit se trouver au même niveau que l'exécutable. Pour Mac OSX, tout se passe dans le paquet `Collatinus.app` (ou tout autre nom que l'on souhaite lui donner) et le dossier `ressources/` doit être placé dans le répertoire `Contents/MacOS/` (à côté de l'exécutable ; cet emplacement n'est probablement pas conforme aux directives d'Apple, et pourrait être modifié dans une version ultérieure). 28 | Pour que ces données soient adaptées à la version bureau de Collatinus, il convient de créer, dans ce répertoire `ressources/`, un sous-répertoire `dicos/` dans lequel seront rangés les fichiers relatifs aux dictionnaires (*.cfg, *.idx, *.css et *.xsl) ainsi que les dictionnaires eux-mêmes. 29 | 30 | Le **manuel d'aide** de Collatinus est disponible dans le dépôt [collatinus-data](https://github.com/biblissima/collatinus-data) (voir le dossier `doc/`; celui-ci devra être laissé à sa place à côté du dossier `ressources/` pour être inclu dans le programme). 31 | 32 | 33 | ## Licence 34 | 35 | Ce programme est mis à disposition par Yves Ouvrard et Philippe Verkerk sous licence [GNU GPL v3](http://www.gnu.org/licenses/gpl.html). 36 | 37 | ## Crédits 38 | 39 | **Remerciements** : William Whitaker †, Jose Luis Redrejo, Georges Khaznadar, Matthias Bussonier, Gérard Jeanneau, Philippe Verkerk, Jean-Paul Woitrain, Philipp Roelli, Perseus Digital Library. 40 | -------------------------------------------------------------------------------- /images/svg/noun_project_94-power.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | image/svg+xml 46 | 51 | 56 | -------------------------------------------------------------------------------- /src/main.h: -------------------------------------------------------------------------------- 1 | /* main.h 2 | * 3 | * This file is part of COLLATINVS. 4 | * 5 | * COLLATINVS 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 along 16 | * with COLLATINVS; if not, write to the Free Software Foundation, Inc., 59 17 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /** 21 | * BOGUES & AGENDA 22 | * 23 | 24 | - fichiers récents dans Settings. 25 | - esse + dat. omniprésent 26 | - conspectus : vérifier le Jeanneau, qui semble confondre in et e 27 | conspectu(m) 28 | - implémenter la lemmatisation de la sélection si la touche Maj est 29 | enfoncée, par exemple, ou la proposer dans un contextuel. 30 | * 31 | */ 32 | 33 | #ifndef MAIN_H 34 | #define MAIN_H 35 | 36 | #include "ui_collatinus.h" 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include "libcollatinus.h" 42 | #include "lewis.h" 43 | #include "maj.h" // mise à jour à partir du serveur distant 44 | 45 | class fenestra; 46 | 47 | class Editeur : public QTextEdit 48 | { 49 | Q_OBJECT 50 | 51 | private: 52 | TLexicum * lexicum; 53 | QStringList listek; 54 | QStringList listekr; // canons ramistes 55 | QStringList listekq; 56 | QString ponctPhr; // = "[\\.\\;\\:\\?\\!]"; 57 | QRegExp sepPhr; 58 | fenestra * fen; 59 | bool scand; // armé si l'onglet Quantites est visible 60 | public: 61 | Editeur (QWidget *parent, const char *name, TLexicum * l, fenestra *f); 62 | QString motCourant (QTextCursor C); 63 | bool debPhr (QTextCursor C); 64 | QString lemmatiseTxt (bool alpha=0, bool cumVocibus = false); 65 | QString lemmatiseTxt_expr (bool alpha = false); 66 | int nbk (); // nombre de lemmes dans la listek 67 | QString kAt (int n); // lemme n° n dans la listek 68 | void purge(); 69 | void videListek (); 70 | void setScand (bool s); 71 | bool scande (); 72 | protected: 73 | void mousePressEvent(QMouseEvent *event); 74 | void mouseMoveEvent (QMouseEvent *event); 75 | void mouseReleaseEvent (QMouseEvent *event); 76 | signals: 77 | void copie (QString, QString); 78 | public slots: 79 | void changeMajPert (bool m); 80 | QStringList req (); 81 | }; 82 | 83 | class fenestra : public QMainWindow, private Ui::MainWindow 84 | { 85 | Q_OBJECT 86 | 87 | public: 88 | fenestra (QString url); 89 | virtual ~fenestra (); 90 | void flechis (Tentree * e); 91 | int editeurCourant (); 92 | QTextEdit * editeurRes (); 93 | private: 94 | void majDic (); 95 | Editeur * EditLatin; 96 | void createActions(); 97 | QActionGroup * grCibles; 98 | QTranslator * translatorF; 99 | QTranslator * translatorE; 100 | TLexicum * lexicum; 101 | void clearModif (); 102 | void capsamInLatinum (const QString &fileName); 103 | bool capsaminDiscum (const QString &fileName); 104 | bool cautio (); 105 | QString repertoire; 106 | QString capsaIn; // nom du fichier chargé 107 | QString capsaEx; // nom fu fichier enregistré 108 | QString nomen; // nom sans chemin ni extension ni _L ni _Q. 109 | QString dernierT; // nom du fichier à enregistrer dans les préférences. 110 | void daFichierCourant (QString fileName); 111 | HttpWindow * httpWin; 112 | QString quaerendum; 113 | bool inuentum; 114 | bool licetMorpho; 115 | ListeDic listeD; 116 | bool idx_lu; 117 | void deest (); 118 | QString lang; 119 | QString ante, post; 120 | 121 | private slots: 122 | void auxilium (); 123 | void decollatino (); 124 | void calepin (); 125 | void lexica_addere_corrigere (); 126 | void inuenire (); 127 | void inuenire_denuo (); 128 | void legere (); 129 | void lemmatiseTout (bool alpha=false); 130 | void alpha (); 131 | void noua (); 132 | bool scribere (); 133 | bool scribereVt (); 134 | void setCible (); 135 | void vide_texte (); 136 | void change_syntaxe (); 137 | void change_morpho (bool m); 138 | void affiche_lien (QUrl url); 139 | void change_glossarium (QString nomDic); 140 | void ecris_prefs (); 141 | void lis_prefs (QString url=""); 142 | QString langInterf (); 143 | 144 | public slots: 145 | void langue_interface (); 146 | void lemmataRadere (); 147 | void frequences (); 148 | void controleIcone (int o); 149 | void affiche_lemmes_dic (QStringList lk, int no=0); 150 | void affiche_lemme_saisie (bool litt=false); 151 | void affiche_lemme_saisie_litt (); 152 | void affiche_flexion_saisie (); 153 | void change_page_djvu (int p); 154 | void clicAnte (); 155 | void clicPost (); 156 | protected: 157 | bool event (QEvent *event); 158 | void closeEvent(QCloseEvent *event); 159 | }; 160 | 161 | #endif 162 | -------------------------------------------------------------------------------- /src/syntaxe.h: -------------------------------------------------------------------------------- 1 | /* syntaxe.h 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 | * PRAELECTOR 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 | */ 20 | 21 | /** 22 | TODO: transformer la recherche d'un canon ds la phrase : 23 | QSet Phrases::canons, alimenté par la liste morphos. 24 | TODO: ajouter la possibilité de plusieurs lemmes pour une position 25 | de l'expression, avec la même morpho 26 | ou même plusieurs lemmes pour la même position, avec des morphos 27 | différentes 28 | TODO: 29 | - le mot noyau est répété : alius... alius ; 30 | - la même expression est répétée dans la phrase. 31 | */ 32 | 33 | #ifndef SYNTAXE_H 34 | #define SYNTAXE_H 35 | #include "libcollatinus.h" 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | /*************************************************/ 43 | // classes côté texte 44 | /*************************************************/ 45 | 46 | class Morphos: public QObject 47 | { 48 | Q_OBJECT 49 | private: 50 | QString canon; 51 | QString graphie; 52 | QStringList elements; 53 | int item; 54 | public: 55 | Morphos (QString mo); 56 | virtual ~Morphos (); 57 | void setCanon (QString c); 58 | QString getCanon (); 59 | QString getGraphie (); 60 | QString humain (); 61 | QString cas (); 62 | QString genre (); 63 | QString nombre (); 64 | void setItem (int i); 65 | int getItem (); 66 | bool accepte (Morphos * mb); 67 | }; 68 | 69 | typedef QList ListeM; 70 | class Mot: public QObject 71 | { 72 | Q_OBJECT 73 | private: 74 | TLexicum * lexicum; 75 | QString graphie; 76 | QString lemme; 77 | ListeM morphos; 78 | void lemmatise (); 79 | bool adopte; 80 | public: 81 | Mot (QString g, TLexicum * lx, bool debut = false); 82 | virtual ~Mot (); 83 | int no; // ordre du mot dans la phrase 84 | int count_morphos (); 85 | QString getGraphie (); 86 | QString getCanon (int i); 87 | QString get_lemme (); 88 | Morphos * getMorpho (int i); 89 | QString humain (int i); 90 | QString humain (); 91 | QString lemmatisation (); 92 | void setAdopte (bool a); 93 | bool estAdopte (); 94 | bool casCommun (Mot * m); 95 | bool nombreCommun (Mot * m); 96 | bool deb_phr; 97 | }; 98 | 99 | /*************************************************/ 100 | // CLASSES CÔTÉ BASE 101 | /*************************************************/ 102 | 103 | class Canon 104 | { 105 | private: 106 | int id; 107 | QString graphie; 108 | public: 109 | Canon (QString g); // création par la graphie 110 | Canon (int i); // lecture à partir de la base 111 | }; 112 | 113 | class Expression 114 | { 115 | private: 116 | QString nom; 117 | QString doc; 118 | QList morphos; 119 | int noyo; // pos dans l'expr du mot sous lequel elle s'affichera 120 | int posInP; // position du noyau dans la phrase 121 | int de; 122 | QString en; 123 | int avec; 124 | public: 125 | Expression (QString n); // créateur avec int id 126 | QString humain (); // notice affichée par Collatinus 127 | QString getNom (); 128 | QString getDoc (); 129 | QString getEn (); 130 | QString lemme_noyau (); 131 | int countMorphos (); 132 | int getPosInP (); 133 | void setPosInP (int p); 134 | Morphos * getMorpho (int im); 135 | bool accordVoulu (); 136 | }; 137 | 138 | typedef QMultiMap L_expressions; 139 | class Liste_expr 140 | { 141 | private: 142 | L_expressions expressions; 143 | public: 144 | Liste_expr (QString f); 145 | ~Liste_expr (); 146 | QList expr_lemme (QString l); 147 | }; 148 | 149 | 150 | // ************* 151 | // CLASSE PHRASE 152 | // ************* 153 | 154 | // phrase du texte préparée pour le 155 | // traitement fait par Requete 156 | class Phrase: public QObject 157 | { 158 | Q_OBJECT 159 | private: 160 | QString graphie; 161 | QList mots; 162 | QList liste_expressions; 163 | TLexicum * lexicum; 164 | void cherche_expressions (); 165 | int de; 166 | int avec; 167 | QString en; 168 | //bool requis_vus (); 169 | public: 170 | int debut; 171 | int fin; // début et fin pour repérage éventuel dans un texte. 172 | Phrase (QString t, TLexicum * l); 173 | virtual ~Phrase (); 174 | bool aiLeCanon (QString c); 175 | QList expressions (); 176 | Mot * mot_no (int n); 177 | Mot * motExpr (Morphos * m); // mot non adopté satisfaisant la morpho m 178 | Expression * expression_no (int n); 179 | bool accord (int de, QString en, int avec); 180 | QString analyse (); 181 | QStringList * analyse_et_lemmes (); 182 | void initAdoptes (); 183 | }; 184 | 185 | 186 | // ************* 187 | // CLASSE TEXTE 188 | // ************* 189 | 190 | class Texte 191 | { 192 | private: 193 | QList phrases; 194 | public: 195 | Texte (); 196 | ~Texte (); 197 | void ajoute_phrase (Phrase * p); 198 | void vide_phrases (); 199 | bool phrase_at_pos (int p); 200 | Phrase * phrase_pos (int p); 201 | }; 202 | 203 | void lis_expr (QString ch); 204 | 205 | void cree_texte (); 206 | 207 | void vide_phrases (); 208 | 209 | bool phrase_at_pos (int p); 210 | 211 | void cree_phrase (QString p, int d, int f, TLexicum * l); 212 | 213 | QString analyse_syntaxique (int p, int mot_no); //, QString &canon); 214 | 215 | 216 | #endif 217 | -------------------------------------------------------------------------------- /images/svg/dicolem.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 39 | 41 | 42 | 44 | image/svg+xml 45 | 47 | 48 | 49 | 50 | 51 | 56 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /src/maj.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * maj.cpp 3 | * 4 | * This file is part of COLLATINVS. 5 | * 6 | * COLLATINVS is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * COLLATINVS is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with COLLATINVS; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "maj.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | HttpWindow::HttpWindow (QWidget *parent) 32 | : QDialog (parent) 33 | { 34 | progressDialog = new QProgressDialog (this); 35 | setupUi (this); 36 | // chemins 37 | repRes = qApp->applicationDirPath () + "/ressources/"; 38 | repDic = repRes + "dicos/"; 39 | // liste des extensions dictionnaire 40 | suffDic.clear (); // en cas de réouverture du dialogue 41 | invis.clear (); // idem 42 | suffIdxCfg << "idx" << "cfg" << "xsl" << "css"; 43 | suffDic << "djvu" << "xml" << suffIdxCfg; 44 | // télécharger l'url du catalogue 45 | append (QStringList () << urlDepot + "url_depot.txt"); 46 | while (!finis) 47 | { 48 | qApp->processEvents (); 49 | } 50 | QFile *fdepot = new QFile (repRes + "url_depot.txt"); 51 | fdepot->open (QIODevice::ReadOnly|QIODevice::Text); 52 | QTextStream flux (fdepot); 53 | depot = flux.readAll ().trimmed (); 54 | fdepot->close (); 55 | delete fdepot; 56 | // télécharger le catalogue 57 | append (QStringList () << depot + "catalogue.txt"); 58 | } 59 | 60 | void HttpWindow::setupUi (QDialog *Dialog) 61 | { 62 | Dialog->setObjectName (QString::fromUtf8 ("Collatinus - mise à jour")); 63 | setModal (true); 64 | verticalLayout = new QVBoxLayout (Dialog); 65 | label = new QLabel (Dialog); 66 | label->setText (tr ("Ajouter ou télécharger.\nIl faudra ensuite relancer Collatinus")); 67 | verticalLayout->addWidget (label); 68 | buttonBox = new QDialogButtonBox (Dialog); 69 | buttonBox->setOrientation (Qt::Horizontal); 70 | boutonTelech = new QPushButton (tr ("&Expromere")); 71 | buttonBox->addButton (boutonTelech, QDialogButtonBox::ActionRole); 72 | buttonBox->setStandardButtons (QDialogButtonBox::Close); 73 | verticalLayout->addWidget (buttonBox); 74 | 75 | QObject::connect (buttonBox, SIGNAL (rejected()), Dialog, SLOT (reject())); 76 | QObject::connect (boutonTelech, SIGNAL (clicked ()), Dialog, SLOT (telecharger ())); 77 | QMetaObject::connectSlotsByName (Dialog); 78 | } 79 | 80 | void HttpWindow::append (const QStringList &urlList) 81 | { 82 | foreach (QString url, urlList) 83 | { 84 | append (QUrl (url)); 85 | finis = false; 86 | } 87 | if (downloadQueue.isEmpty()) 88 | { 89 | QTimer::singleShot(0, this, SIGNAL(finished())); 90 | } 91 | } 92 | 93 | void HttpWindow::append(const QUrl &url) 94 | { 95 | if (downloadQueue.isEmpty()) 96 | QTimer::singleShot(0, this, SLOT(startNextDownload())); 97 | 98 | downloadQueue.enqueue(url); 99 | ++totalCount; 100 | } 101 | 102 | QString HttpWindow::saveFileName(const QUrl &url) 103 | { 104 | // extraire le nom du fichier, et le chemin de 105 | // destination : ressources ou ressources/dicos. 106 | QString path = url.toString (); 107 | QString basename = path.section ('/', -1); 108 | if (basename.isEmpty()) 109 | basename = "sine_nomine"; 110 | if (suffDic.contains (QFileInfo (basename).suffix ())) 111 | basename.prepend (repDic); 112 | else basename.prepend (repRes); 113 | return basename; 114 | } 115 | 116 | void HttpWindow::startNextDownload() 117 | { 118 | if (downloadQueue.isEmpty()) 119 | { 120 | emit finished(); 121 | finis = true; 122 | peupleCombos (); 123 | return; 124 | } 125 | finis = false; 126 | progressDialog->show (); 127 | QUrl url = downloadQueue.dequeue (); 128 | QString filename = saveFileName (url); 129 | output.setFileName (filename); 130 | if (!output.open(QIODevice::WriteOnly)) 131 | { 132 | fprintf(stderr, "Problème d'ouverture '%s' pour télécharger '%s': %s\n", 133 | qPrintable(filename), url.toEncoded().constData(), 134 | qPrintable(output.errorString())); 135 | startNextDownload(); 136 | return; // skip this download 137 | } 138 | QNetworkRequest request(url); 139 | request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork); 140 | currentDownload = manager.get(request); 141 | connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)), 142 | SLOT(downloadProgress(qint64,qint64))); 143 | connect(currentDownload, SIGNAL(finished()), 144 | SLOT(downloadFinished())); 145 | connect(currentDownload, SIGNAL(readyRead()), 146 | SLOT(downloadReadyRead())); 147 | // prepare the output 148 | // printf("Downloading %s\n", url.toEncoded().constData()); 149 | // downloadTime.start(); 150 | } 151 | 152 | void HttpWindow::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) 153 | { 154 | if (httpRequestAborted) 155 | return; 156 | progressDialog->setMaximum(bytesTotal); 157 | progressDialog->setValue(bytesReceived); 158 | } 159 | 160 | void HttpWindow::downloadFinished () 161 | { 162 | progressDialog->hide (); 163 | output.close(); 164 | if (currentDownload->error()) 165 | { 166 | // download failed 167 | fprintf(stderr, "Failed: %s\n", qPrintable(currentDownload->errorString())); 168 | } 169 | currentDownload->deleteLater(); 170 | startNextDownload(); 171 | } 172 | 173 | ListeF HttpWindow::ls (QString d) 174 | { 175 | QDir dir (d); 176 | QFileInfoList infoList = dir.entryInfoList (); 177 | ListeF lf; 178 | foreach (QFileInfo fileInfo, infoList) 179 | { 180 | if (fileInfo.isDir ()) 181 | continue; 182 | QString octets; 183 | octets.setNum (fileInfo.size ()); 184 | lf << (QStringList () << fileInfo.fileName () << octets); 185 | } 186 | return lf; 187 | } 188 | 189 | 190 | void HttpWindow::downloadReadyRead() 191 | { 192 | output.write (currentDownload->readAll()); 193 | } 194 | 195 | void HttpWindow::peupleCombos () 196 | { 197 | QFile *fcatalogue = new QFile (repRes + "catalogue.txt"); 198 | fcatalogue->open (QIODevice::ReadOnly|QIODevice::Text); 199 | QTextStream flux (fcatalogue); 200 | QString tout = flux.readAll (); 201 | fcatalogue->close (); 202 | delete fcatalogue; 203 | 204 | QStringList ll = tout.split ("\n"); 205 | ListeF lfd; // liste distants 206 | foreach (QString l, ll) 207 | { 208 | if (l.length () > 4) 209 | { 210 | lfd << l.split (":"); 211 | } 212 | } 213 | // vider les cases à cocher; 214 | foreach (QCheckBox *cb, lcb) 215 | { 216 | verticalLayout->removeWidget (cb); 217 | delete cb; 218 | } 219 | lcb.clear (); 220 | 221 | // établir la liste des fichiers locaux dans ./ressources/ 222 | ListeF lfl; // liste locaux 223 | lfl << ls (repRes); 224 | lfl << ls (repDic); 225 | bool present = false; 226 | foreach (QStringList ld, lfd) 227 | { 228 | present = false; 229 | foreach (QStringList ll, lfl) 230 | { 231 | // comparaison des noms 232 | if (ld[0] == ll[0]) 233 | { 234 | present = true; 235 | // comparaison des tailles 236 | if (ld[1] != ll[1]) 237 | { 238 | // si le fichier est visible 239 | if (ld.count () > 2) 240 | { 241 | QCheckBox *cb = new QCheckBox ("Mettre à jour " + ld[2]); 242 | cb->setObjectName (ld[0]); 243 | verticalLayout->insertWidget (1, cb); 244 | lcb << cb; 245 | } 246 | else invis << ld[0]; 247 | } 248 | } 249 | } 250 | if (!present) 251 | { 252 | // fichier distant absent en local 253 | if (ld.count () > 2) 254 | { 255 | QCheckBox *cb = new QCheckBox ("Ajouter " + ld[2]); 256 | cb->setObjectName (ld[0]); 257 | verticalLayout->insertWidget (1, cb); 258 | lcb << cb; 259 | } 260 | else invis << ld[0]; 261 | } 262 | } 263 | } 264 | 265 | void HttpWindow::telecharger () 266 | { 267 | QStringList liste; 268 | foreach (QCheckBox * cb, lcb) 269 | { 270 | if (cb->isChecked ()) 271 | { 272 | QString nom = cb->objectName (); 273 | QFileInfo finfo (nom); 274 | QString suff = finfo.suffix (); 275 | // ajouter les satellites du dictionnaire 276 | if ((QStringList () << "djvu" << "xml").contains (suff)) 277 | { 278 | foreach (QString f, invis) 279 | { 280 | QFileInfo finfo2 (f); 281 | if (finfo.baseName () == finfo2.baseName () 282 | && suffIdxCfg.contains (finfo2.suffix ())) 283 | { 284 | liste << (depot+f); 285 | } 286 | } 287 | } 288 | liste << (depot + nom); 289 | } 290 | } 291 | append (liste); 292 | } 293 | -------------------------------------------------------------------------------- /src/libcollatinus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libcollatinus.h 3 | * 4 | * This file is part of COLLATINVS. 5 | * 6 | * COLLATINVS is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * COLLATINVS is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with COLLATINVS; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | */ 21 | 22 | #ifndef LIBCOLLATINUS_H 23 | #define LIBCOLLATINUS_H 24 | 25 | #include 26 | #include 27 | // #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | 37 | namespace Ch 38 | { 39 | /* Fonctions de conversion */ 40 | void deQuant (QString *c); 41 | QString ini (QString c, int n); // ini donne la chaine c tronquée de n caractères à droite 42 | QString jviu (QString ch); // jviu transforme la graphie ramiste en graphie ancienne 43 | int aRomano (QString R); // Fonction de conversion des chiffres romains en chiffres arabes. 44 | QString ote_diacritiques (QString k); 45 | QString deramise (QString k); 46 | const QString consonnes = "bcdfgjklmnpqrstvxz"; 47 | const QString voyelles ("a\u0101\u0103e\u0113\u0115i\u012b\u012do\u014d\u014fu\u016b\u016dy\u0233\u045e"); 48 | const QString longues ("\\x0101\\x0113\\x012b\\x014d\\x016b\u045e"); 49 | const QString aaq ("\u0101dc,\u0101df,\u0101dg,\u0101dl,\u0101dp,\u0101dq,\u0101dr,\u0101dst,\u0101dsc,\u0101dsp," 50 | "\u0101ds,\u0101dt,\u0101ps,c\u014dnl,c\u014dnm,c\u014dnp,c\u014dnr,\u0113xs,\u012bnb,\u012bnl,\u012bnm,\u012bnp," 51 | "\u012bnr,\u014dbc,\u014dbf,\u014dbp,\u014dps,s\u016bbc,s\u016bbf,s\u016bbg,s\u016bbm,s\u016bpt"); 52 | const QString apq ("\u0101cc,\u0101ff,\u0101gg,\u0101ll,\u0101pp,\u0101cq,\u0101rr,\u0101st,\u0101sc,\u0101sp," 53 | "\u0101ss,\u0101tt,\u0101bs,c\u014dll,c\u014dmm,c\u014dmp,c\u014drr,\u0113x,\u012bmb,\u012bll,\u012bmm,\u012bmp," 54 | "\u012brr,\u014dcc,\u014dff,\u014dpp,\u014dbs,s\u016bcc,s\u016bff,s\u016bgg,s\u016bmm,s\u016bbt"); 55 | 56 | const QString aa ("adc,adf,adg,adl,adp,adq,adr,adst,adsc,adsp," 57 | "ads,adt,aps,conl,conm,conp,conr,exs,inb,inl,inm,inp," 58 | "inr,obc,obf,obp,ops,subc,subf,subg,subm,supt"); 59 | const QString ap ("acc,aff,agg,all,app,acq,arr,ast,asc,asp," 60 | "ass,att,abs,coll,comm,comp,corr,ex,imb,ill,imm,imp," 61 | "irr,occ,off,opp,obs,succ,suff,sugg,summ,subt"); 62 | const QStringList assimAnte = aa.split (","); 63 | const QStringList assimPost = ap.split (","); 64 | const QStringList assimAnteq = aaq.split (","); 65 | const QStringList assimPostq = apq.split (","); 66 | QString assimile (QString f, int &i); 67 | QString assimileq (QString f, int i); 68 | bool estNombre (QString s); 69 | // expressions rationnelles 70 | const QRegExp reLettres ("\\w+"); 71 | const QRegExp reEspace ("\\s+"); 72 | const QRegExp rePonct ("[\\.?!;:]"); 73 | const QRegExp rePoncprem ("^[\\W]+"); 74 | const QRegExp rePoncDer ("\\W+$"); 75 | const QRegExp reAlphas ("(\\w+)"); 76 | const QRegExp reNonAlphas ("\\W+"); 77 | } 78 | 79 | /* classes */ 80 | 81 | class Traits: public QObject 82 | { 83 | Q_OBJECT 84 | private: 85 | QBitArray bits; 86 | public: 87 | Traits (int k, int g, int n, int d, int p, int t, int m, int v); 88 | virtual ~Traits (); 89 | QBitArray getBits (); 90 | QString humain (); 91 | int casus (); 92 | int genus (); 93 | int numerus (); 94 | int gradus (); 95 | int persona (); 96 | int tempus (); 97 | int modus (); 98 | int uox (); 99 | bool contient (Traits * t); 100 | /* 101 | QString cas (); 102 | QString genre (); 103 | QString nombre (); 104 | QString degre (); 105 | QString personne (); 106 | QString temps (); 107 | QString mode (); 108 | QString voix (); 109 | */ 110 | }; 111 | 112 | class Tdes 113 | { 114 | private: 115 | QString gr; // graphie 116 | Traits * traits; 117 | QList mo; // modèle (paradigma) 118 | int rn; // numéro de radical (radix_num) 119 | QString grq; // graphie avec quantités 120 | public: 121 | /* 122 | * Format d'une ligne de lemmata.fr : 123 | * graph|casus|genus|numerus|gradus|persona|tempus|modus|uox|paradigma|radix_num 124 | */ 125 | Tdes (QString linea); 126 | QString graphie (); 127 | QList mdl (); 128 | QString grquant (); // accesseur de grq 129 | QStringList modele (); 130 | int nr (); 131 | Traits * getTraits (); 132 | QString morpho (); 133 | QString doc (); 134 | }; 135 | 136 | class Tirr; 137 | 138 | /* classe des entrées */ 139 | class Tentree: public QObject 140 | { 141 | Q_OBJECT 142 | private: 143 | QString k; // canon sans quantités 144 | QString kq; // canon avec quantités, comme dans le dictionnaire 145 | QString fcq; // forme canonique entièrement mesurée 146 | QString kjv; // canon ramiste 147 | int nh; // numéro d'homonymie 148 | int mdl; 149 | QString cf; 150 | QMap radq; 151 | QList irregs; 152 | QMap trad; 153 | QString indMorph; // indications morphologiques 154 | QList adv; // entrée adj. utilisée pour les degrés d'un ou plusieurs adv. 155 | // caractéristiques morpho 156 | bool init_neutre (); 157 | bool neutre; 158 | int nombre; 159 | void init_nombre (); 160 | bool init_deponent (); 161 | bool deponent; 162 | bool init_intrans (); 163 | bool intrans; 164 | void init_radicaux (QStringList eclats); 165 | void init_quantites (); 166 | public: 167 | Tentree (QString linea); 168 | virtual ~Tentree (); 169 | bool egale (Tentree * e); 170 | QString canon (); 171 | QString canonR (); // canon ramiste 172 | int numh (); // accesseur pour h 173 | static QString ote2 (QString k, int &h); 174 | QString getCf (); 175 | int modele (); 176 | char pars (); 177 | QStringList radicalq (int n); 178 | QString grmodele (); 179 | QString quantite (); 180 | QString definition (QString l); // l : langue 181 | void ajTrad (QString lang, QString * tr); 182 | void setAdv (Tentree * e); 183 | void setIndMorph (QString im); 184 | QList getAdv (); 185 | QString * traduction (QString lang); 186 | QString ambrogio (); 187 | bool est_neutre (); 188 | int getNombre (); 189 | bool aUnSingulier (); 190 | bool aUnPluriel (); 191 | bool est_deponent (); 192 | bool est_intransitif (); 193 | QList irreguliers (); 194 | void ajIrr (Tirr * irr); 195 | QString doc (); 196 | }; 197 | 198 | /* classe des radicaux */ 199 | 200 | class Tradix 201 | { 202 | private: 203 | Tentree * e; 204 | int mo; // modèle 205 | int num; // numéro de radical 206 | bool eni; 207 | QString k; // canon 208 | QString grq; 209 | public: 210 | Tradix (Tentree *entree, int m, int n, QString q, bool ii=false); 211 | int mdl (); 212 | bool en_i (); 213 | int nr (); 214 | int nbl (); // nombre de langues pointées par private:e 215 | Tentree * entree (); 216 | void ajouteEntree (Tentree *entree); 217 | QString canon (); 218 | QString grquant (); // accesseur de grq 219 | QString doc (); 220 | }; 221 | 222 | class AnalyseMorpho: public QObject 223 | { 224 | Q_OBJECT 225 | private: 226 | Tentree * e; 227 | Tdes * des; 228 | Traits * traits; 229 | QString q; // devient le seul radical (le 4 mars 2014) 230 | QString dq; // nécessaire pour le superlatif de l'adverbe 231 | QString suffixe; // le suffixe sera conservé ici 232 | bool db_i; 233 | public: 234 | AnalyseMorpho (QString rq, Tdes * d, Tentree * en, QString 235 | suff="", bool ii = false); 236 | AnalyseMorpho (QString rq, Traits * t, Tentree * en, QString ddq=""); 237 | ~AnalyseMorpho (); 238 | // pour les indéclinables et la 3ème décl, la 239 | // forme entière est dans rq. 240 | Tentree * entree (); 241 | void setSuff (QString s); // Pour les enclitiques, je dois pouvoir ajouter un suffixe après coup 242 | QString getD (); // pour récupérer la désinence 243 | void setQ (QString nq); // pour changer le radical; 244 | QString getQ (); // pour récupérer le radical 245 | QString getForm (); // Le collage radical+désinence+suffixe se fera ici 246 | void setUpper (); 247 | void assimileq (int i); 248 | Traits * getTraits (); 249 | QString humain (); 250 | }; 251 | 252 | typedef std::multimap ListeAnalyses; 253 | 254 | /* classe des irréguliers */ 255 | class Tirr: public QObject 256 | { 257 | Q_OBJECT 258 | private: 259 | QString gr; 260 | QString grq; 261 | Tentree * e; 262 | Traits * traits; 263 | bool excl; 264 | public: 265 | Tirr (QString linea, Tentree * entr); 266 | virtual ~Tirr (); 267 | Tentree * entree (); 268 | QString graphie (); 269 | QString graphieq (); 270 | QString morpho (); 271 | bool exclusif (); 272 | Traits * getTraits (); 273 | bool homomorphe (Tdes * des); 274 | }; 275 | 276 | 277 | /* classe lexique */ 278 | class TLexicum: public QObject 279 | { 280 | Q_OBJECT 281 | private: 282 | QMap metae; 283 | bool MajPert; 284 | // liste d'entrées 285 | QString lingua; // langue courante 286 | QString linguaTr; // langue, nom vernaculaire complet 287 | Traits * bitsComp; // morpho de l'adv au comparatif 288 | Traits * bitsSup; // au superlatif 289 | typedef QHash c2e; 290 | // liste des listes d'entrées, par langue (ca, de, es, fr, gl, uk) 291 | // liste des entrées 292 | c2e entrees; 293 | QList adjAdv; // entrées d'adj utilisés pour les degrés d'un ou plusieurs adv. 294 | QList entreesCf; // entrées utlisisant la trad. d'une autre 295 | typedef std::multimap c2d; 296 | // liste des désinences 297 | c2d desinentiae; 298 | // liste des irréguliers 299 | typedef std::multimap c2i; 300 | c2i irregulares; 301 | // liste des radicaux 302 | QMap > modelesRad; 303 | typedef std::multimap c2r; 304 | c2r radices; 305 | // type liste de radicaux 306 | typedef std::list lr; 307 | typedef QPair Regle; 308 | void lemmataLege (); 309 | void pronominaLege (); 310 | void linguamLege (QString lang); 311 | QList regles; 312 | QString voyelles; 313 | QString ponctPhr; 314 | ListeAnalyses lanalysesE (QString forme); // enclitiques 315 | ListeAnalyses lanalysesA (QString forme); // assimilations 316 | ListeAnalyses corAnalyses (QString forme); // cœur du moteur d'analyse 317 | 318 | public: 319 | TLexicum (); 320 | virtual ~TLexicum (); 321 | QMap cible (); 322 | void changeMajPert (bool m); 323 | Tentree *renvoi (Tentree *e); // renvoi d'entrée si la déf. commence par cf. 324 | Tentree * entree (QString k); 325 | void dicLinguam (QString lang); 326 | QString lang (); 327 | QString ambrogio (Tentree * e); 328 | void uniLanalyses (ListeAnalyses& l1, ListeAnalyses& l2); 329 | void deleteAnalyses (ListeAnalyses la); 330 | QString radical (QString r); 331 | QString assimile (QString f); 332 | QString analyses (QString f); 333 | void lajoute (QString l, ListeAnalyses& la, AnalyseMorpho * am); 334 | ListeAnalyses lanalyses (QString forme, bool deb_phr=false); 335 | QStringList lemmatiseM (QString f, bool mm=true, bool deb_phr = false); // analyse morphologique, début de phrase 336 | QString lemmatiseTxt (QString txt, bool alpha=0, bool cumVocibus = false); 337 | QString par_position (QString f); 338 | QStringList synthA (Tentree* e, int c, int n, int g, int d); 339 | QStringList synthPart (Tentree* e, int c, int g, int n, int t, int v); 340 | QStringList synthN (Tentree *e, int c, int n); 341 | QStringList synthP (Tentree* e, int c, int n, int g); 342 | QStringList synthV (Tentree* e, int p, int n, int t, int m, int v); 343 | QString flechis (Tentree* e); 344 | QStringList formeq (QString forme, bool *nonTrouve, bool deb_phr=true); 345 | QString scandeTxt (QString texte, bool stats = false); 346 | QStringList frequences (QString txt); 347 | }; 348 | 349 | bool sort_i (const QString &s1, const QString &s2); 350 | 351 | #endif 352 | -------------------------------------------------------------------------------- /images/svg/help-browser.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 22 | 29 | 31 | 35 | 39 | 40 | 43 | 47 | 51 | 52 | 63 | 65 | 69 | 73 | 74 | 85 | 96 | 97 | 120 | 134 | 135 | 137 | 138 | 140 | image/svg+xml 141 | 143 | Help Browser 144 | 2005-11-06 145 | 146 | 147 | Tuomas Kuosmanen 148 | 149 | 150 | 151 | 152 | help 153 | browser 154 | documentation 155 | docs 156 | man 157 | info 158 | 159 | 160 | 162 | 163 | 164 | Jakub Steiner, Andreas Nilsson 165 | 166 | 167 | http://tigert.com 168 | 169 | 171 | 173 | 175 | 177 | 178 | 179 | 180 | 184 | 194 | 204 | 214 | 223 | 224 | 225 | -------------------------------------------------------------------------------- /images/svg/edit-alpha.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 17 | 19 | 23 | 27 | 28 | 30 | 34 | 38 | 39 | 41 | 45 | 49 | 50 | 52 | 56 | 60 | 61 | 63 | 67 | 71 | 72 | 74 | 78 | 82 | 83 | 91 | 99 | 108 | 117 | 127 | 137 | 146 | 154 | 162 | 171 | 180 | 189 | 198 | 207 | 216 | 224 | 232 | 240 | 248 | 256 | 264 | 272 | 280 | 288 | 289 | 291 | 292 | 294 | image/svg+xml 295 | 297 | 298 | 2006-01-04 299 | 300 | 301 | Lapo Calamandrei 302 | 303 | 304 | http://tango-project.org 305 | 306 | 307 | text 308 | a 309 | bold 310 | write 311 | letter 312 | 313 | 314 | 316 | 317 | 318 | Andreas Nilsson 319 | 320 | 321 | 322 | 324 | 326 | 328 | 330 | 331 | 332 | 333 | 336 | 341 | 342 | 345 | 349 | 353 | 354 | 358 | 362 | 363 | 364 | 365 | -------------------------------------------------------------------------------- /images/svg/system-search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 22 | 29 | 31 | 35 | 39 | 40 | 42 | 46 | 50 | 54 | 55 | 58 | 62 | 66 | 67 | 70 | 74 | 78 | 79 | 81 | 85 | 89 | 90 | 92 | 96 | 100 | 101 | 103 | 107 | 111 | 115 | 116 | 126 | 136 | 147 | 158 | 167 | 178 | 187 | 188 | 209 | 211 | 212 | 214 | image/svg+xml 215 | 217 | 218 | 219 | Jakub Steiner 220 | 221 | 222 | http://jimmac.musichall.cz 223 | 225 | 226 | 228 | 230 | 232 | 234 | 235 | 236 | 237 | 241 | 243 | 253 | 258 | 262 | 267 | 277 | 287 | 297 | 307 | 311 | 312 | 313 | 314 | -------------------------------------------------------------------------------- /src/lewis.cpp: -------------------------------------------------------------------------------- 1 | /* lewis.cpp 2 | * 3 | * This file is part of COLLATINVS. 4 | * 5 | * COLLATINVS 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 COLLATINVS; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include "lewis.h" 22 | #include 23 | 24 | /**************** 25 | * Dictionnaire * 26 | ****************/ 27 | 28 | Dictionnaire::Dictionnaire (QString cfg) 29 | { 30 | QFileInfo fi(cfg); 31 | repertoire = qApp->applicationDirPath () + "/ressources/dicos/"; 32 | n = fi.baseName ().section ('.', 0); 33 | // lire le fichier de ressource cfg 34 | QSettings settings (repertoire + cfg, QSettings::IniFormat); 35 | settings.setIniCodec ("utf-8"); 36 | settings.beginGroup ("droits"); 37 | auteur = settings.value ("auteur").toString (); 38 | url = settings.value ("url").toString (); 39 | settings.endGroup (); 40 | settings.beginGroup ("fichiers"); 41 | chData = repertoire + settings.value ("data").toString (); 42 | debut = settings.value ("debut").toInt (); 43 | echelle = settings.value ("echelle").toString (); 44 | if (echelle.isEmpty ()) echelle = "160"; 45 | idxJv = repertoire + n + ".idx"; 46 | settings.endGroup (); 47 | settings.beginGroup ("remplacements"); 48 | cond_jv = settings.value ("condjv").toString (); 49 | ji = settings.value ("ji").toInt (); 50 | JI = settings.value ("JI").toInt (); 51 | settings.endGroup (); 52 | settings.beginGroup ("style"); 53 | xsl = settings.value ("xsl").toInt (); 54 | settings.endGroup (); 55 | xml = QFileInfo (chData).suffix () == "xml"; 56 | djvu = !xml; 57 | } 58 | 59 | QString Dictionnaire::nom () 60 | { 61 | return n; 62 | } 63 | 64 | 65 | QString Dictionnaire::convert (QString source) 66 | { 67 | QXmlQuery query(QXmlQuery::XSLT20); 68 | query.setFocus (source); 69 | QString fichier = repertoire + n + ".xsl"; 70 | QFile xml2html (fichier); 71 | xml2html.open (QIODevice::ReadOnly|QIODevice::Text); 72 | query.setQuery (&xml2html); 73 | QString html, retour; 74 | QTextStream ts (&retour); 75 | ts.setCodec ("UTF-8"); 76 | query.evaluateTo (&html); 77 | ts << html; 78 | return retour ; 79 | } 80 | 81 | QString Dictionnaire::entree_pos (qint64 pos) 82 | { 83 | QFile file (chData); 84 | file.open (QFile::ReadOnly | QFile::Text); 85 | file.seek (pos); 86 | QTextStream ts (&file); 87 | ts.setCodec ("UTF-8"); 88 | QString linea = ts.readLine (); 89 | file.close (); 90 | if (xsl) 91 | { 92 | linea = convert (linea); 93 | return linea; 94 | } 95 | else 96 | { 97 | linea.replace("H1>","strong>"); 98 | linea.prepend("
\n"); 99 | return linea; 100 | } 101 | return "Error. Nil legere potui."; 102 | } 103 | 104 | void Dictionnaire::vide_index () 105 | { 106 | idxDjvu.clear (); 107 | } 108 | 109 | void Dictionnaire::vide_ligneLiens () 110 | { 111 | ligneLiens.clear (); 112 | } 113 | 114 | bool Dictionnaire::lis_index_djvu () 115 | { 116 | QFile f (idxJv); 117 | if (!f.open (QIODevice::ReadOnly | QIODevice::Text)) 118 | return false; 119 | QTextStream ts (&f); 120 | while (!f.atEnd ()) 121 | { 122 | idxDjvu << f.readLine ().trimmed (); 123 | } 124 | f.close (); 125 | return true; 126 | } 127 | 128 | QString Dictionnaire::pageDjvu (int p) 129 | { 130 | #ifdef Q_OS_MAC 131 | QString sortie_qt = QDir::homePath () + "/.pagefelix.tif"; 132 | QString sortie_ddjvu = QDir::homePath() + "/.pagefelix.tif"; 133 | QString ddjvu = "/Applications/DjView.app/Contents/bin/ddjvu"; 134 | #else 135 | #ifdef Q_OS_WIN32 136 | QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); 137 | QString sortie_ddjvu = QDir::toNativeSeparators (env.value ("TMP")+ "/pagefelix.tif"); 138 | QString sortie_qt = QDir::tempPath () + "/pagefelix.tif"; 139 | #else 140 | QString sortie_qt = QDir::homePath () + "/.pagefelix.tif"; 141 | QString sortie_ddjvu = QDir::homePath() + "/.pagefelix.tif"; 142 | QString ddjvu = "/usr/bin/ddjvu"; 143 | #endif 144 | #endif 145 | QStringList args; 146 | args << "-format=tif" 147 | << "-page=" + QString::number (p) 148 | << "-scale=" + echelle 149 | << chData 150 | << sortie_ddjvu; 151 | QObject * parent = new QObject; 152 | QProcess * proc = new QProcess (parent); 153 | proc->setWorkingDirectory(qApp->applicationDirPath ()); 154 | QString pg; 155 | #ifdef Q_OS_WIN32 156 | QString ddjvu = "ddjvu.exe"; 157 | proc->start (ddjvu, args); 158 | #else 159 | if (!QFile::exists(ddjvu)) 160 | { 161 | QTextStream (&pg) << "

Il faut installer DjView.app\n" 162 | "dans le dossier Applications.
\n" 163 | "\n" 164 | "DjVuLibre_MacOS

"; 165 | } 166 | { 167 | proc->start (ddjvu, args); 168 | } 169 | #endif 170 | proc->waitForFinished (-1); 171 | if ((proc->error () == QProcess::ReadError) || (proc->exitCode ())) 172 | QTextStream (&pg) << "Fichier djvu ou "<< sortie_ddjvu << " introuvable
\n" 173 | "Sous Linux, installer le paquet djview
\n" 174 | "Collatinux X.1 - Licence GNU-GPL"; 175 | else 176 | { 177 | QTextStream (&pg) << auteur << " " << url << " " 178 | << "
\n" << ligneLiens << "
\n"; 179 | } 180 | delete proc; 181 | return pg; 182 | } 183 | 184 | QString Dictionnaire::pageDjvu (QStringList req, int no) 185 | { 186 | // seul le lemme n° noLien est affiché, les autres sont en hyperliens. 187 | // Si l'index chargé est le bon, inutile de le relire. 188 | QString leLem = req[no]; 189 | if (idxDjvu.isEmpty ()) 190 | { 191 | lis_index_djvu (); 192 | } 193 | pdj = debut; 194 | foreach (QString l, idxDjvu) 195 | { 196 | if (QString::compare (l, leLem, Qt::CaseInsensitive) > 0) 197 | { 198 | break; 199 | } 200 | ++pdj; 201 | } 202 | ligneLiens.clear (); 203 | foreach (QString lien, req) 204 | ligneLiens.append (""+lien+" "); 205 | return pageDjvu (pdj); 206 | } 207 | 208 | QString Dictionnaire::pageXml (QStringList req) 209 | { 210 | QString pg; // contenu de la page de retour 211 | llew listeE; 212 | QFile * findex = NULL; 213 | ligneLiens.clear (); 214 | foreach (QString l, req) 215 | { 216 | l = l.toLower (); 217 | findex = new QFile (idxJv); 218 | if (ji) l.replace ('j', 'i'); 219 | if (findex == NULL || !findex->open(QFile::ReadOnly | QFile::Text)) 220 | { 221 | prec = "error"; 222 | suiv = "error"; 223 | return "Error"; 224 | } 225 | QString linea; 226 | QStringList eclats; 227 | QString avanDerCh, derCh, ch; 228 | bool trouve = false; 229 | int trouve1 = -10; // on commence avec trouve1 négatif puisque "a" est < l 230 | int p; 231 | while (trouve1 < 0) // on s'arrête quand on a dépassé l 232 | { 233 | linea = findex->readLine (); 234 | p = linea.indexOf(":"); 235 | if (p > -1) 236 | { 237 | avanDerCh = derCh; 238 | derCh = ch; 239 | eclats = linea.split(":"); 240 | ch = eclats[0]; 241 | trouve = QString::compare (ch, l, Qt::CaseInsensitive ) == 0; 242 | trouve1 = QString::compare (ch, l+"1", Qt::CaseInsensitive ); 243 | // trouve1 est un entier qui est la différence entre les chaines 244 | if (trouve) 245 | { 246 | prec = derCh; 247 | if (eclats.size() == 3) 248 | listeE.append (pairL (eclats[2].trimmed (), eclats[1].toLongLong ())); 249 | else listeE.append (pairL (ch, eclats[1].toLongLong ())); 250 | linea = findex->readLine (); 251 | eclats = linea.split (":"); 252 | ch = eclats [0]; 253 | trouve1 = 1; 254 | } 255 | else if (trouve1 == 0) 256 | { 257 | prec = derCh; 258 | while (QRegExp ("^"+l+"\\d+$").exactMatch (ch.toLower ())) 259 | { 260 | if (eclats.size() == 3) 261 | listeE.append (pairL (eclats[2].trimmed (), eclats[1].toLongLong ())); 262 | else listeE.append (pairL (ch, eclats[1].toLongLong ())); 263 | linea = findex->readLine (); 264 | eclats = linea.split(":"); 265 | ch = eclats[0]; 266 | 267 | } 268 | } 269 | else if (trouve1 > 0 || findex->atEnd ()) 270 | { 271 | QString rl = ramise (l); 272 | if (rl != l) 273 | { 274 | QStringList lramise; 275 | lramise << rl; 276 | return pageXml (lramise); 277 | } 278 | prec = derCh; 279 | if (eclats.size() == 3) 280 | listeE.append (pairL (eclats[2].trimmed (), eclats[1].toLongLong ())); 281 | else listeE.append (pairL (ch, eclats[1].toLongLong ())); 282 | break; 283 | } 284 | // je ne suis pas sûr que ce dernier else soit nécessaire 285 | } 286 | } 287 | suiv = eclats[0]; 288 | findex->close (); 289 | } 290 | 291 | int i = 0; 292 | while (i < listeE.size()) 293 | { 294 | if (ligneLiens.contains("")) 295 | listeE.removeAt(i); 296 | else 297 | { 298 | ligneLiens.append (""+listeE[i].first+" "); 299 | ++i; 300 | } 301 | } 302 | ligneLiens.append ("
\n"); 303 | for (int i=0;i"); 306 | pg.append ("
\n" + ligneLiens); 307 | QString np = entree_pos (listeE[i].second); 308 | pg.append (np); 309 | pg.append (""); 310 | } 311 | if (QFile::exists (repertoire + n + ".css")) 312 | { 313 | pg.prepend ("\n"); 314 | } 315 | pg.prepend (auteur + " "+url+ " "); 316 | /* 317 | // code de débogage 318 | QFile fdebug ("debug.html"); 319 | fdebug.open (QFile::WriteOnly | QFile::Text); 320 | QTextStream fl (&fdebug); 321 | fl << pg; 322 | fdebug.close (); 323 | */ 324 | return pg; 325 | } 326 | 327 | QString Dictionnaire::page (QStringList req, int no) 328 | { 329 | if (xml) 330 | return pageXml (req); 331 | else // djvu 332 | { 333 | liens = req; 334 | return pageDjvu (req, no); // passage de req pour les hyperliens 335 | } 336 | } 337 | 338 | bool Dictionnaire::estXml () 339 | { 340 | return xml; 341 | } 342 | 343 | QString Dictionnaire::pgPrec () 344 | { 345 | return prec; 346 | } 347 | 348 | QString Dictionnaire::pgSuiv () 349 | { 350 | return suiv; 351 | } 352 | 353 | int Dictionnaire::noPageDjvu () 354 | { 355 | return pdj; 356 | } 357 | 358 | QString Dictionnaire::indexJv () 359 | { 360 | return idxJv; 361 | } 362 | 363 | QStringList Dictionnaire::links () 364 | { 365 | return liens; 366 | } 367 | 368 | /**************** 369 | * ListeDic * 370 | *****************/ 371 | 372 | Dictionnaire * ListeDic::dictionnaire_par_nom (QString nom) 373 | { 374 | QMap::iterator retour = liste.find (nom); 375 | if (retour == liste.end ()) 376 | return NULL; 377 | return retour.value (); 378 | } 379 | 380 | void ListeDic::ajoute (Dictionnaire *d) 381 | { 382 | liste.insert (d->nom (), d); 383 | } 384 | 385 | void ListeDic::change_courant (QString nom) 386 | { 387 | currens = dictionnaire_par_nom (nom); 388 | } 389 | 390 | Dictionnaire * ListeDic::courant () 391 | { 392 | return currens; 393 | } 394 | 395 | QString Dictionnaire::ramise (QString f) 396 | { 397 | if (!ji) 398 | f = f.replace (QRegExp ("(^|[aeo]+|^in|^ad|^per)i([aeiou])"), "\\1j\\2"); 399 | f = f.replace (QRegExp ("(^|[aeio]+|^in|^ad|^per)u([aeiou])"), "\\1v\\2"); 400 | f = f.replace (QRegExp ("(^|[\\w]+r)u([aeiou])"), "\\1v\\2"); 401 | return f; 402 | } 403 | 404 | /* 405 | Copie du fichier téléchargé L&S en xml dans 406 | ressources ; Création d'un index, à ensuite 407 | dédoubler en transformant v en u et j en i. Il 408 | faudra enfin trier les deux par ordre alphabétique, 409 | et éliminer la première ligne, qui ne correspond à 410 | aucune entrée. 411 | */ 412 | /* 413 | bool andromeda (QString nf) 414 | { 415 | QFile fandr (nf); 416 | if (!fandr.open (QFile::ReadOnly | QFile::Text)) 417 | return false; 418 | // QFile::copy (nf, qApp->applicationDirPath () + "/ressources/lewis.xml"); 419 | QFile findex (qApp->applicationDirPath () + "/ressources/lewis.idx"); 420 | // QFile::copy (nf, qApp->applicationDirPath () + "/ressources/ducange.xml"); 421 | // QFile findex (qApp->applicationDirPath () + "/ressources/du.idx"); 422 | if (!findex.open (QFile::WriteOnly | QFile::Text)) 423 | return false; 424 | QString linea; 425 | QString cle; 426 | QTextStream fli (&findex); 427 | fli.setCodec ("UTF-8"); 428 | qint64 p; 429 | fandr.seek (0); 430 | while (!fandr.atEnd ()) 431 | { 432 | // flux.flush (); 433 | p = fandr.pos (); 434 | linea = fandr.readLine (); 435 | // int pos = exp.indexIn (linea); 436 | // ducange : 437 | //QRegExp expr ("(

)([^<]+)(

)"); 438 | //int pos = expr.indexIn (linea); 439 | //if (pos > -1) 440 | //{ 441 | // cle = expr.cap (2); 442 | // fli << cle << ":" << p << "\n"; 443 | //} 444 | 445 | // pour lewis 446 | QRegExp exp ("(^.*key=\")([^\"]+)(\".*$)"); 447 | int pos = exp.indexIn (linea); 448 | if (pos > -1) 449 | { 450 | cle = exp.cap (2); 451 | fli << cle << ":" << p << "\n"; 452 | } 453 | } 454 | fandr.close (); 455 | findex.close (); 456 | return true; 457 | } 458 | */ 459 | 460 | 461 | 462 | /* 463 | // Ramiste 464 | QStringList exceptions; 465 | exceptions << "Achaia" << "Aglaia" << "aio" << "ambubaia" << "baia" << "Baiae" 466 | << "Caia" << "caiatio" << "Caieta" << "caio" << "Graii" << "Graioceli" 467 | << "Isaias" << "Laiades" << "maia" << "Panchaia"; 468 | */ 469 | 470 | /* 471 | // Dans le cas de téléchagement à partir 472 | // d'Andromeda : 473 | cle.replace (QChar (0x0100), 'A'); 474 | cle.replace (QChar (0x0101), 'a'); 475 | cle.replace (QChar (0x0102), 'A'); 476 | cle.replace (QChar (0x0103), 'a'); 477 | cle.replace (QChar (0x0112), 'E'); 478 | cle.replace (QChar (0x0113), 'e'); 479 | cle.replace (QChar (0x0114), 'E'); 480 | cle.replace (QChar (0x0115), 'e'); 481 | cle.replace (QChar (0x012a), 'I'); 482 | cle.replace (QChar (0x012b), 'i'); 483 | cle.replace (QChar (0x012c), 'I'); 484 | cle.replace (QChar (0x012d), 'i'); 485 | cle.replace (QChar (0x014c), 'O'); 486 | cle.replace (QChar (0x014d), 'o'); 487 | cle.replace (QChar (0x014e), 'O'); 488 | cle.replace (QChar (0x014f), 'o'); 489 | cle.replace (QChar (0x016a), 'U'); 490 | cle.replace (QChar (0x016b), 'u'); 491 | cle.replace (QChar (0x016c), 'U'); 492 | cle.replace (QChar (0x016d), 'u'); 493 | // quelques caractères inusités : 494 | cle.replace (QChar (0x0233), 'y'); 495 | cle.replace (QChar (0x0304), 'i'); 496 | cle.replace (QChar (0x0306), 'i'); 497 | cle.replace (QChar (0x5e), ""); // ^ 498 | // non ramiste ! mais traiter les composés 499 | // de iacio 500 | if (cle.endsWith ("jicio")) 501 | { 502 | cle.replace ("jicio", "icio"); 503 | } 504 | else 505 | { 506 | cle.replace ('j', 'i'); 507 | } 508 | cle.replace ('J', 'I'); 509 | cle.replace ('v', 'u'); 510 | cle.replace ('V', 'U'); 511 | */ 512 | -------------------------------------------------------------------------------- /images/svg/document-new.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 25 | 32 | 43 | 46 | 50 | 54 | 55 | 66 | 68 | 72 | 76 | 80 | 81 | 91 | 94 | 98 | 102 | 103 | 114 | 116 | 120 | 124 | 125 | 133 | 137 | 141 | 142 | 150 | 154 | 158 | 159 | 161 | 165 | 169 | 170 | 172 | 176 | 180 | 181 | 183 | 187 | 191 | 195 | 196 | 206 | 217 | 228 | 239 | 250 | 261 | 262 | 281 | 283 | 284 | 286 | image/svg+xml 287 | 289 | New Document 290 | 291 | 292 | Jakub Steiner 293 | 294 | 295 | http://jimmac.musichall.cz 296 | 298 | 299 | 301 | 303 | 305 | 307 | 308 | 309 | 310 | 314 | 318 | 325 | 330 | 335 | 336 | 337 | 342 | 350 | 359 | 362 | 366 | 374 | 378 | 382 | 383 | 387 | 395 | 399 | 403 | 404 | 408 | 409 | 413 | 417 | 418 | 423 | 428 | 429 | 434 | 447 | 448 | 449 | -------------------------------------------------------------------------------- /src/syntaxe.cpp: -------------------------------------------------------------------------------- 1 | /* syntaxe.cpp 2 | * 3 | * This file is part of COLLATINVS. 4 | * 5 | * COLLATINVS 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 COLLATINVS; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | // #include "frequences.h" 22 | #include "syntaxe.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | // liste établie d'après libcollatinus.cpp, qui sont 30 | // des arrays de QString. 31 | QStringList k = QStringList () << "nom." << "voc." << "acc." << "gen." << "dat." << "abl."; 32 | QStringList g = QStringList () << "masc." << "fem." << "neut."; 33 | QStringList n = QStringList () << "sing." << "plur."; 34 | QStringList d = QStringList () << "posit." << "compar." << "superl."; 35 | QStringList p = QStringList () << "prim." << "sec." << "ter."; 36 | QStringList t = QStringList () << "praes." << "fut." << "imperf." << "perf." << "fut. ant." << "plus-quam-perf."; 37 | QStringList m = QStringList () << "ind." << "coniunct." << "imper." << "infin." << "part." << "gerund." << "adiect. verb."; 38 | QStringList v = QStringList () << "act." << "pass."; 39 | 40 | //*************** 41 | // CLASSE MORPHOS 42 | //*************** 43 | 44 | Morphos::Morphos (QString mo) 45 | { 46 | // éclater en sous-chaînes 47 | if (!mo.isEmpty ()) mo = mo.simplified (); 48 | if (mo.isEmpty ()) 49 | { 50 | graphie = ""; 51 | return; 52 | } 53 | elements = mo.split (QRegExp ("\\W+")); 54 | QStringList eclats = elements; 55 | QStringList gr; 56 | QString el; 57 | foreach (el, eclats) 58 | if (k.contains (el)) 59 | { 60 | gr << el; 61 | eclats.replace(eclats.indexOf (el), ""); 62 | } 63 | foreach (el, eclats) 64 | if (g.contains (el)) 65 | { 66 | gr << el; 67 | eclats.replace(eclats.indexOf (el), ""); 68 | } 69 | foreach (el, eclats) 70 | if (n.contains (el)) 71 | { 72 | gr << el; 73 | eclats.replace(eclats.indexOf (el), ""); 74 | } 75 | foreach (el, eclats) 76 | if (d.contains (el)) 77 | { 78 | gr << el; 79 | eclats.replace(eclats.indexOf (el), ""); 80 | } 81 | foreach (el, eclats) 82 | if (p.contains (el)) 83 | { 84 | gr << el; 85 | eclats.replace(eclats.indexOf (el), ""); 86 | } 87 | foreach (el, eclats) 88 | if (t.contains (el)) 89 | { 90 | gr << el; 91 | eclats.replace(eclats.indexOf (el), ""); 92 | } 93 | foreach (el, eclats) 94 | if (m.contains (el)) 95 | { 96 | gr << el; 97 | eclats.replace(eclats.indexOf (el), ""); 98 | } 99 | foreach (el, eclats) 100 | if (v.contains (el)) 101 | { 102 | gr << el; 103 | eclats.replace(eclats.indexOf (el), ""); 104 | } 105 | graphie = gr.join (" ").simplified (); 106 | } 107 | 108 | Morphos::~Morphos () 109 | { 110 | } 111 | 112 | void Morphos::setCanon (QString c) 113 | { 114 | canon = c; 115 | } 116 | 117 | QString Morphos::getCanon () 118 | { 119 | return canon; 120 | } 121 | 122 | QString Morphos::getGraphie () 123 | { 124 | return graphie; 125 | } 126 | 127 | void Morphos::setItem (int i) 128 | { 129 | item = i; 130 | } 131 | 132 | int Morphos::getItem () 133 | { 134 | return item; 135 | } 136 | 137 | /** 138 | * Morphos::accepte (Morphos * mb) 139 | * Vérifie que la morpho d'expression peut utiliser 140 | * la morpho de phrase mb 141 | */ 142 | bool Morphos::accepte (Morphos * mb) 143 | { 144 | QString mbK = mb->getCanon (); 145 | if (!canon.isEmpty ()) 146 | { 147 | if (canon.contains (',')) 148 | { 149 | QStringList eclatsC = canon.split (','); 150 | if (!eclatsC.contains (mbK)) return false; 151 | } 152 | else 153 | { 154 | if (canon != mbK) return false; 155 | } 156 | 157 | } 158 | if (graphie.isEmpty ()) return true; 159 | QStringList eclatsExpr = graphie.split (" "); 160 | QStringList eclatsP = mb->getGraphie ().split (" "); 161 | foreach (QString ee, eclatsExpr) 162 | { 163 | if (eclatsP.indexOf (ee) < 0) 164 | { 165 | return false; 166 | } 167 | } 168 | return true; 169 | } 170 | 171 | QString Morphos::cas () 172 | { 173 | foreach (QString el, elements) 174 | if (k.contains (el)) return el; 175 | return ""; 176 | } 177 | 178 | QString Morphos::genre () 179 | { 180 | foreach (QString el, elements) 181 | if (g.contains (el)) return el; 182 | return ""; 183 | } 184 | 185 | QString Morphos::nombre () 186 | { 187 | foreach (QString el, elements) 188 | if (n.contains (el)) return el; 189 | return ""; 190 | } 191 | 192 | QString Morphos::humain () 193 | { 194 | return QString ("%1.%2").arg (canon).arg (graphie); 195 | } 196 | 197 | // ********** 198 | // CLASSE MOT 199 | // ********** 200 | 201 | Mot::Mot (QString g, TLexicum * l, bool debut) 202 | { 203 | lexicum = l; 204 | graphie = g; 205 | deb_phr = debut; 206 | lemmatise (); 207 | adopte = false; 208 | } 209 | 210 | Mot::~Mot () 211 | { 212 | foreach (Morphos * morph, morphos) 213 | delete morph; 214 | morphos.clear (); 215 | } 216 | 217 | void Mot::lemmatise () 218 | { 219 | ListeAnalyses analyses = lexicum->lanalyses (graphie, deb_phr); 220 | // enregistrer la lemmatisation 221 | QString mo; 222 | QTextStream flux (&mo); 223 | flux.setCodec("UTF-8"); 224 | QTextStream fll (&lemme); 225 | fll.setCodec("UTF-8"); 226 | Morphos * morph; 227 | QString ancienL, nouvoL; 228 | // convertir le retour des analyses en instances de Morphos 229 | if (analyses.empty ()) 230 | fll << graphie << " ?"; 231 | for (std::multimap::iterator it = analyses.begin (); 232 | it != analyses.end ();++it) 233 | { 234 | mo = it->second->humain (); 235 | morph = new Morphos (mo); 236 | morph->setCanon (it->second->entree ()->canon ()); 237 | morphos << morph; 238 | mo.clear (); 239 | nouvoL = it->second->entree ()->definition (lexicum->lang ()); // valider 240 | if (nouvoL != ancienL) 241 | fll << "
\n" << nouvoL; 242 | ancienL = nouvoL; 243 | } 244 | // debog 245 | lexicum->deleteAnalyses (analyses); 246 | } 247 | 248 | QString Mot::getGraphie () 249 | { 250 | return graphie; 251 | } 252 | 253 | int Mot::count_morphos () 254 | { 255 | return morphos.count (); 256 | } 257 | 258 | QString Mot::getCanon (int i) 259 | { 260 | if (i < morphos.size ()) 261 | return morphos[i]->getCanon (); 262 | return ""; 263 | } 264 | 265 | Morphos * Mot::getMorpho (int i) 266 | { 267 | return morphos[i]; 268 | } 269 | 270 | QString Mot::humain (int i) 271 | { 272 | return morphos[i]->humain (); 273 | } 274 | 275 | QString Mot::humain () 276 | { 277 | QString retour = graphie ; 278 | QTextStream flux (&retour); 279 | flux.setCodec("UTF-8"); 280 | foreach (Morphos * morph, morphos) 281 | flux << "\n - " << morph->humain (); 282 | return retour; 283 | } 284 | 285 | QString Mot::get_lemme () 286 | { 287 | return lemme; 288 | } 289 | 290 | void Mot::setAdopte (bool a) 291 | { 292 | adopte = a; 293 | } 294 | 295 | bool Mot::estAdopte () 296 | { 297 | return adopte; 298 | } 299 | 300 | bool Mot::casCommun (Mot * m) 301 | { 302 | foreach (Morphos * maMorpho, morphos) 303 | for (int i = 0;icount_morphos();++i) 304 | if (maMorpho->cas () == m->getMorpho (i)->cas ()) return true; 305 | return false; 306 | } 307 | 308 | bool Mot::nombreCommun (Mot * m) 309 | { 310 | foreach (Morphos * maMorpho, morphos) 311 | for (int i = 0;icount_morphos();++i) 312 | if (maMorpho->nombre () == m->getMorpho (i)->nombre ()) return true; 313 | return false; 314 | } 315 | 316 | // ***************** 317 | // CLASSE EXPRESSION 318 | // ***************** 319 | 320 | Expression::Expression (QString n) 321 | { 322 | QStringList eclats = n.split ('|'); 323 | nom = eclats[0]; 324 | doc = eclats[1]; 325 | noyo = eclats[2].toInt (); 326 | int ie = 3; 327 | while (ie < eclats.size ()) 328 | { 329 | QStringList liste = eclats[ie].split ('.'); 330 | Morphos * m = new Morphos (liste[1]); 331 | m->setCanon (liste[0]); 332 | if (!liste[2].isEmpty ()) 333 | { 334 | de = ie; 335 | en = liste[2]; 336 | avec = liste[3].toInt (); 337 | } 338 | else 339 | { 340 | avec = -1; 341 | } 342 | morphos.append (m); 343 | ie++; 344 | } 345 | } 346 | 347 | QString Expression::getNom () 348 | { 349 | return nom; 350 | } 351 | 352 | QString Expression::getDoc () 353 | { 354 | return doc; 355 | } 356 | 357 | QString Expression::getEn () 358 | { 359 | return en; 360 | } 361 | 362 | int Expression::countMorphos () 363 | { 364 | return morphos.size (); 365 | } 366 | 367 | Morphos * Expression::getMorpho (int im) 368 | { 369 | if (im < morphos.size ()) 370 | return morphos [im]; 371 | return NULL; 372 | } 373 | 374 | QString Expression::humain () 375 | { 376 | QString retour; 377 | QTextStream (&retour) << nom << " : " << doc; 378 | return retour; 379 | } 380 | 381 | QString Expression::lemme_noyau () 382 | { 383 | return morphos[noyo]->getCanon (); 384 | } 385 | 386 | int Expression::getPosInP () 387 | { 388 | return posInP; 389 | } 390 | 391 | void Expression::setPosInP (int p) 392 | { 393 | posInP = p; 394 | } 395 | 396 | bool Expression::accordVoulu () 397 | { 398 | return avec >= 0; 399 | } 400 | 401 | /* 402 | ************************ 403 | classe Liste_expr 404 | }; 405 | ************************ 406 | */ 407 | 408 | Liste_expr::Liste_expr (QString f) 409 | { 410 | QFile file(f); 411 | if (!file.open(QFile::ReadOnly | QFile::Text)) 412 | { 413 | //QMessageBox::warning(this, "Collatinus", "Capsam legere nequeo expressions.fr"); 414 | return; 415 | } 416 | 417 | QTextStream in(&file); 418 | in.setCodec ("UTF-8"); 419 | QString lin; 420 | lin = in.readLine (); 421 | while (!lin.isNull ()) 422 | { 423 | Expression * E = new Expression (lin); 424 | // injection 425 | expressions.insert (E->lemme_noyau (), E); 426 | lin = in.readLine (); 427 | } 428 | } 429 | 430 | Liste_expr::~Liste_expr () 431 | { 432 | 433 | } 434 | 435 | QList Liste_expr::expr_lemme (QString l) 436 | { 437 | return expressions.values (l); 438 | } 439 | 440 | Liste_expr * LExpressions; 441 | 442 | // ************* 443 | // CLASSE PHRASE 444 | // ************* 445 | 446 | Phrase::Phrase (QString t, TLexicum * l) 447 | { 448 | lexicum = l; 449 | graphie = t.simplified (); 450 | Mot * nmot; 451 | QStringList liste = graphie.split (QRegExp ("\\W+")); 452 | QString eclat; 453 | int j = 0; 454 | for (int i=0; i < liste.count (); ++i) 455 | { 456 | eclat = liste[i]; 457 | if (eclat.isEmpty ()) 458 | continue; 459 | // passer les nombre 460 | bool intN=false; 461 | eclat.toInt (&intN); 462 | if (intN) continue; 463 | nmot = new Mot (eclat, lexicum, i==0); 464 | nmot->no = j; 465 | mots << nmot; 466 | j++; 467 | } 468 | cherche_expressions (); 469 | } 470 | 471 | Phrase::~Phrase () 472 | { 473 | foreach (Mot * mot, mots) 474 | delete mot; 475 | mots.clear (); 476 | } 477 | 478 | bool Phrase::aiLeCanon (QString c) 479 | { 480 | if (c.isEmpty ()) return true; 481 | if (c.contains (',')) 482 | { 483 | QStringList lc = c.split (','); 484 | foreach (QString cc, lc) 485 | foreach (Mot * mot, mots) 486 | { 487 | for (int i=0; i < mot->count_morphos (); ++i) 488 | if (mot->getCanon (i) == cc) 489 | return true; 490 | } 491 | } 492 | else 493 | { 494 | foreach (Mot * mot, mots) 495 | for (int i=0; i < mot->count_morphos (); ++i) 496 | if (mot->getCanon (i) == c) return true; 497 | } 498 | return false; 499 | } 500 | 501 | // sert pour Expression::expressions () 502 | // évite les doublons dans la recherche d'expressions 503 | bool contient (QList liste, Expression * expr) 504 | { 505 | foreach (Expression * e, liste) 506 | if (e->getNom () == expr->getNom ()) return true; 507 | return false; 508 | } 509 | 510 | /** 511 | * Renvoie le premier mot de la phrase non adopté, 512 | * satisfaisant à la demande du membre d'expression m. 513 | * en profite pour marquer adopté le mot renvoyé. 514 | */ 515 | Mot * Phrase::motExpr (Morphos * m) 516 | { 517 | foreach (Mot * imot, mots) 518 | { 519 | for (int i = 0;icount_morphos ();++i) 520 | { 521 | if ((!imot->estAdopte ()) && m->accepte (imot->getMorpho (i))) 522 | { 523 | imot->setAdopte (true); 524 | return imot; 525 | } 526 | } 527 | } 528 | return NULL; 529 | } 530 | 531 | bool Phrase::accord (int de, QString en, int avec) 532 | { 533 | Mot * motDe = mot_no (de); 534 | Mot * motAvec = mot_no (avec); 535 | if (en.contains ('n') && !motDe->nombreCommun (motAvec)) return false; 536 | if (en.contains ('c') && !motDe->casCommun (motAvec)) return false; 537 | return true; 538 | } 539 | 540 | void Phrase::cherche_expressions () 541 | { 542 | // pour chaque mot de la phrase 543 | foreach (Mot * mot, mots) 544 | { 545 | // pour chaque canon du mot 546 | for (int i=0;icount_morphos ();++i) 547 | { 548 | // s'il n'est pas noyo potentiel, mot suivant 549 | QList le = LExpressions->expr_lemme (mot->getCanon (i)); 550 | if (le.isEmpty ()) continue; 551 | // ici, possibilité de renvoyer toute expression utilisant le mot 552 | // pour chaque expression potentielle 553 | foreach (Expression * expr, le) 554 | { 555 | initAdoptes (); 556 | // pour chaque mot requis de l'expression 557 | bool esuiv = false; 558 | for (int im = 0; im < expr->countMorphos (); im++) 559 | { 560 | // mot absent de la phrase, expression suivante 561 | if (!aiLeCanon (expr->getMorpho (im)->getCanon ())) 562 | { 563 | esuiv = true; 564 | continue; 565 | } 566 | } 567 | if (esuiv) continue; 568 | // ici, possibilité de renvoyer les expressions sans vérif de morpho 569 | for (int im = 0; im < expr->countMorphos (); ++im) 570 | { 571 | // nauis longa|navire de guerre|0|nauis...|longus.f.cn.0 572 | // si aucun des mots repérés n'a la bonne morpho, expr. suivante 573 | // bogue 2014 (encore). 574 | Mot * mota = motExpr (expr->getMorpho (im)); 575 | if (mota == NULL) 576 | { 577 | esuiv = true; 578 | continue; 579 | } 580 | if (expr->accordVoulu ()) 581 | { 582 | de = mot->no; 583 | avec = mota->no; 584 | en = expr->getEn (); 585 | } 586 | } 587 | if (esuiv) continue; 588 | //vérifier l'accord 589 | if (avec >= 0 && !accord (de, en, avec)) continue; 590 | // ajouter le n° du mot + l'expression � la phrase 591 | if (!contient (liste_expressions, expr)) 592 | { 593 | expr->setPosInP (mot->no); 594 | liste_expressions << expr; 595 | } 596 | } 597 | } 598 | } 599 | } 600 | 601 | QList Phrase::expressions () 602 | { 603 | return liste_expressions; 604 | } 605 | 606 | QString Phrase::analyse () 607 | { 608 | QString retour; 609 | QTextStream flux (&retour); 610 | QList liste = expressions (); 611 | foreach (Expression * e, liste) 612 | flux << e->getNom () << " : " << e->getDoc () << "\n"; 613 | return retour; 614 | } 615 | 616 | Mot * Phrase::mot_no (int n) 617 | { 618 | if (n < 0 || n < mots.size ()) return mots[n]; 619 | return NULL; 620 | } 621 | 622 | Expression * Phrase::expression_no (int n) 623 | { 624 | QString retour; 625 | foreach (Expression * expr, expressions ()) 626 | if (expr->getPosInP () == n) 627 | return expr; 628 | return NULL; 629 | } 630 | 631 | QStringList * Phrase::analyse_et_lemmes () 632 | { 633 | QStringList * retour = new QStringList (); 634 | QString doc; 635 | Expression * e = NULL; 636 | for (int i = 0; i < mots.count (); ++i) 637 | { 638 | QString lemma (mots[i]->getCanon (0)); 639 | e = expression_no (i); 640 | if (e != NULL) 641 | retour->append (mots[i]->get_lemme () + "
\n  " + QString (0x00B6) + " " + e->getNom () + " : " + e->getDoc ()); 642 | else retour->append (mots[i]->get_lemme ()); 643 | } 644 | return retour; 645 | } 646 | 647 | void Phrase::initAdoptes () 648 | { 649 | foreach (Mot * m, mots) 650 | m->setAdopte (false); 651 | de = -1; 652 | en = ""; 653 | avec = -1; 654 | } 655 | 656 | // ************ 657 | // CLASSE TEXTE 658 | // ************ 659 | 660 | Texte::Texte () 661 | { 662 | } 663 | 664 | Texte::~Texte () 665 | { 666 | foreach (Phrase * phr, phrases) 667 | delete phr; 668 | phrases.clear (); 669 | } 670 | 671 | void Texte::ajoute_phrase (Phrase * p) 672 | { 673 | phrases << p; 674 | } 675 | 676 | void Texte::vide_phrases () 677 | { 678 | foreach (Phrase * phr, phrases) 679 | delete phr; 680 | phrases.clear (); 681 | } 682 | 683 | bool Texte::phrase_at_pos (int p) 684 | { 685 | return phrase_pos (p) != NULL; 686 | } 687 | 688 | Phrase * Texte::phrase_pos (int p) 689 | { 690 | foreach (Phrase * phr, phrases) 691 | if (p >= phr->debut && p <= phr->fin) 692 | return phr; 693 | return NULL; 694 | } 695 | 696 | 697 | /* 698 | ************************ 699 | Fonctions hors classe 700 | ************************ 701 | */ 702 | 703 | void lis_expr (QString ch) 704 | { 705 | LExpressions = new Liste_expr (ch); 706 | } 707 | 708 | Texte * texte; 709 | 710 | void cree_texte () 711 | { 712 | texte = new Texte (); 713 | } 714 | 715 | void vide_phrases () 716 | { 717 | if (texte == NULL) return; 718 | texte->vide_phrases (); 719 | } 720 | 721 | bool phrase_at_pos (int p) 722 | { 723 | return texte->phrase_at_pos (p); 724 | } 725 | 726 | void cree_phrase (QString p, int d, int f, TLexicum * l) 727 | { 728 | Phrase * phr = new Phrase (p, l); 729 | phr->debut = d; 730 | phr->fin = f; 731 | texte->ajoute_phrase (phr); 732 | } 733 | 734 | // appel d'analyse syntaxique 735 | QString analyse_syntaxique (int p, int motNo) //, QString &canon) 736 | { 737 | if (p < 0) return ""; 738 | QString retour; 739 | Phrase * phr = texte->phrase_pos (p); 740 | if (phr == NULL) return ""; 741 | // canon = phr->mot_no(motNo)->getCanon (0); 742 | foreach (Expression * expr, phr->expressions ()) 743 | { 744 | if (expr->getPosInP () == motNo) 745 | { 746 | // retour précédé du signe unicode '|P' ou 00B6 (182) 747 | // QTextStream (&retour) << "\n " << QString (0x00B6) << " " << expr->getNom () << " : " << expr->getDoc (); 748 | QTextStream (&retour) << QString (0x00B6) << " " << expr->getNom () << " : " << expr->getDoc (); 749 | } 750 | 751 | } 752 | return retour; 753 | } 754 | -------------------------------------------------------------------------------- /images/svg/edit-clear.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 25 | 32 | 35 | 39 | 43 | 44 | 46 | 50 | 54 | 58 | 59 | 61 | 65 | 69 | 73 | 74 | 76 | 80 | 84 | 85 | 96 | 98 | 102 | 106 | 110 | 111 | 113 | 117 | 121 | 122 | 125 | 129 | 133 | 134 | 144 | 154 | 164 | 174 | 184 | 194 | 204 | 214 | 225 | 234 | 235 | 254 | 256 | 257 | 259 | image/svg+xml 260 | 262 | Edit Clear 263 | 264 | 265 | Andreas Nilsson 266 | 267 | 268 | http://www.tango-project.org 269 | 270 | 271 | clear 272 | reset 273 | blank 274 | edit 275 | 276 | 277 | 279 | 280 | 281 | Jakub Steiner (although minimally ;) 282 | 283 | 284 | 285 | 287 | 289 | 291 | 293 | 294 | 295 | 296 | 300 | 310 | 315 | 320 | 325 | 330 | 335 | 340 | 345 | 350 | 355 | 360 | 365 | 375 | 385 | 390 | 395 | 400 | 405 | 410 | 415 | 416 | 417 | -------------------------------------------------------------------------------- /images/svg/folder-open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 25 | 32 | 43 | 46 | 50 | 54 | 55 | 66 | 68 | 72 | 76 | 80 | 81 | 91 | 94 | 98 | 102 | 103 | 105 | 109 | 113 | 114 | 117 | 121 | 125 | 126 | 137 | 139 | 143 | 147 | 148 | 150 | 154 | 158 | 159 | 161 | 165 | 169 | 170 | 172 | 176 | 180 | 181 | 191 | 201 | 211 | 222 | 232 | 241 | 242 | 261 | 263 | 264 | 266 | image/svg+xml 267 | 269 | Folder Icon Accept 270 | 2005-01-31 271 | 272 | 273 | Jakub Steiner 274 | 275 | 276 | 278 | http://jimmac.musichall.cz 279 | Active state - when files are being dragged to. 280 | 281 | 282 | Novell, Inc. 283 | 284 | 285 | 286 | 287 | Garrett LeSage 288 | 289 | 290 | 291 | 293 | 295 | 297 | 299 | 300 | 301 | 302 | 306 | 310 | 314 | 321 | 326 | 331 | 332 | 340 | 345 | 350 | 358 | 363 | 368 | 377 | 384 | 385 | 390 | 395 | 400 | 405 | 410 | 415 | 420 | 425 | 430 | 441 | 449 | 457 | 462 | 467 | 472 | 477 | 478 | 482 | 483 | --------------------------------------------------------------------------------