Grammalecte  Check-in [73ecf7a6c0]

Overview
Comment:[lo] lexicon editor: search
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | lo | multid
Files: files | file ages | folders
SHA3-256: 73ecf7a6c0feb4ea3e6eb8e0bff9231241c16a65cf6a1e4d8eb06cdcfbbab52e
User & Date: olr on 2018-03-27 09:02:55
Other Links: branch diff | manifest | tags
Context
2018-03-27
13:01
[lo] lexical editor: wait pointers check-in: 3a15f6b206 user: olr tags: lo, multid
09:02
[lo] lexicon editor: search check-in: 73ecf7a6c0 user: olr tags: lo, multid
08:54
[graphspell][js] spellchecker: getSimilarEntries with parameter nSuggLimit check-in: e02a5c60ae user: olr tags: graphspell, multid
Changes

Modified gc_lang/fr/oxt/DictOptions/SearchWords.py from [996d15698b] to [19b4306ad7].

   109    109           # widget
   110    110           nX1 = 10
   111    111           nX2 = nX1 + 130
   112    112   
   113    113           nY0 = 5
   114    114           nY1 = nY0 + 20
   115    115           nY2 = nY1 + 60
   116         -        nY3 = nY2 + 95
   117    116   
   118    117           nHeight = 10
   119    118   
   120    119           #### Search
   121    120           self._addWidget("search_section", 'FixedLine', nX1, nY0, 120, nHeight, Label = self.dUI.get("search_section", "#err"), FontDescriptor = xFDTitle)
   122         -        self._addWidget("similar_search_section", 'FixedLine', nX1, nY1, 120, nHeight, Label = self.dUI.get("similar_search_section", "#err"), FontDescriptor = xFDTitle)
          121  +        self._addWidget("similar_search_section", 'FixedLine', nX1, nY1, 120, nHeight, Label = self.dUI.get("similar_search_section", "#err"), FontDescriptor = xFDSubTitle)
   123    122           self.xWord = self._addWidget('word', 'Edit', nX1, nY1+10, 100, nHeight)
   124    123           self._addWidget('similar_search_button', 'Button', nX1, nY1+22, 55, 12, Label = self.dUI.get('similar_search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500)
   125    124   
   126    125   
   127    126           self._addWidget("regex_search_section", 'FixedLine', nX1, nY2, 120, nHeight, Label = self.dUI.get("regex_search_section", "#err"), FontDescriptor = xFDSubTitle)
   128    127           self._addWidget('flexion_label', 'FixedText', nX1, nY2+10, 30, nHeight, Label = self.dUI.get('flexion', "#err"))
   129    128           self.xFlexion = self._addWidget('flexion', 'Edit', nX1+35, nY2+10, 85, nHeight)
   130    129           self._addWidget('tags_label', 'FixedText', nX1, nY2+22, 30, nHeight, Label = self.dUI.get('tags', "#err"))
   131    130           self.xTags = self._addWidget('tags', 'Edit', nX1+35, nY2+22, 85, nHeight)
   132    131           self._addWidget('regex_search_button', 'Button', nX1, nY2+34, 55, 12, Label = self.dUI.get('regex_search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500)
          132  +        self._addWidget('result_warning', 'FixedText', nX1, nY2+50, 120, nHeight*7, Label = self.dUI.get('result_warning', '#err'), MultiLine = True)
   133    133   
   134    134           #### Results
   135    135           self._addWidget("result_section", 'FixedLine', nX2, nY0, 200, nHeight, Label = self.dUI.get("result_section", "#err"), FontDescriptor = xFDTitle)
   136    136           self.xGridModel = self._addGrid("list_grid_search", nX2, nY0+10, 200, 265, [
   137    137               {"Title": self.dUI.get("res_flexion", "#err"), "ColumnWidth": 70},
   138    138               {"Title": self.dUI.get("res_lemma", "#err"), "ColumnWidth": 60},
   139    139               {"Title": self.dUI.get("res_tags", "#err"), "ColumnWidth": 70}
................................................................................
   165    165               elif xActionEvent.ActionCommand == "SearchRegex":
   166    166                   self.searchRegex()
   167    167               elif xActionEvent.ActionCommand == "Close":
   168    168                   self.xContainer.endExecute()
   169    169           except:
   170    170               traceback.print_exc()
   171    171   
          172  +    def initSpellChecker (self):
          173  +        if not self.oSpellChecker:
          174  +            self.oSpellChecker = sc.SpellChecker("fr", "fr.bdic", "", "", "")
          175  +
   172    176       def searchSimilar (self):
   173         -        pass
          177  +        self.initSpellChecker()
          178  +        sWord = self.xWord.Text.strip()
          179  +        if sWord:
          180  +            xGridDataModel = self.xGridModel.GridDataModel
          181  +            xGridDataModel.removeAllRows()
          182  +            lResult = self.oSpellChecker.getSimilarEntries(sWord, 20);
          183  +            for i, aEntry in enumerate(lResult):
          184  +                xGridDataModel.addRow(i, aEntry)
   174    185   
   175    186       def searchRegex (self):
   176         -        pass
          187  +        self.initSpellChecker()
          188  +        sFlexPattern = self.xFlexion.Text.strip()
          189  +        sTagsPattern = self.xTags.Text.strip()
          190  +        xGridDataModel = self.xGridModel.GridDataModel
          191  +        xGridDataModel.removeAllRows()
          192  +        for i, aEntry in enumerate(self.oSpellChecker.select(sFlexPattern, sTagsPattern)):
          193  +            xGridDataModel.addRow(i, aEntry)
          194  +            i += 1
          195  +            if i >= 2000:
          196  +                break

Modified gc_lang/fr/oxt/DictOptions/sw_strings.py from [60c13c015b] to [3a2ca9bcb9].

    12     12           "similar_search_section": "Graphies similaires",
    13     13           "similar_search_button": "Chercher",
    14     14   
    15     15           "regex_search_section": "Expression régulières",
    16     16           "flexion": "Flexion",
    17     17           "tags": "Étiquettes",
    18     18           "regex_search_button": "Chercher",
           19  +        "result_warning": "La recherche par expressions régulières peut générer un nombre gigantesque de résultats. Seules les 2000 premières occurrences trouvées seront affichées. La recherche peut être longue, parce tout le graphe de mots, qui contient 500 000 flexions, sera parcouru si besoin.",
    19     20   
    20     21           "result_section": "Résultats",
    21     22           "res_flexion": "Flexions",
    22     23           "res_lemma": "Lemmes",
    23     24           "res_tags": "Étiquettes",
    24     25           
    25     26           "close_button": "Fermer",