Nuspell
spellchecker
suggester.hxx
1 /* Copyright 2016-2021 Dimitrij Mijoski
2  *
3  * This file is part of Nuspell.
4  *
5  * Nuspell is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * Nuspell 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 Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with Nuspell. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef NUSPELL_SUGGESTER_HXX
20 #define NUSPELL_SUGGESTER_HXX
21 
22 #include "checker.hxx"
23 
24 namespace nuspell {
25 inline namespace v5 {
26 
27 struct NUSPELL_EXPORT Suggester : public Checker {
28 
29  enum High_Quality_Sugs : bool {
30  ALL_LOW_QUALITY_SUGS = false,
31  HAS_HIGH_QUALITY_SUGS = true
32  };
33 
34  auto suggest_priv(std::string_view input_word, List_Strings& out) const
35  -> void;
36 
37  auto suggest_low(std::string& word, List_Strings& out) const
38  -> High_Quality_Sugs;
39 
40  auto add_sug_if_correct(std::string& word, List_Strings& out) const
41  -> bool;
42 
43  auto uppercase_suggest(const std::string& word, List_Strings& out) const
44  -> void;
45 
46  auto rep_suggest(std::string& word, List_Strings& out) const -> void;
47 
48  auto try_rep_suggestion(std::string& word, List_Strings& out) const
49  -> void;
50 
51  auto max_attempts_for_long_alogs(std::string_view word) const -> size_t;
52 
53  auto map_suggest(std::string& word, List_Strings& out) const -> void;
54 
55  auto map_suggest(std::string& word, List_Strings& out, size_t i,
56  size_t& remaining_attempts) const -> void;
57 
58  auto adjacent_swap_suggest(std::string& word, List_Strings& out) const
59  -> void;
60 
61  auto distant_swap_suggest(std::string& word, List_Strings& out) const
62  -> void;
63 
64  auto keyboard_suggest(std::string& word, List_Strings& out) const
65  -> void;
66 
67  auto extra_char_suggest(std::string& word, List_Strings& out) const
68  -> void;
69 
70  auto forgotten_char_suggest(std::string& word, List_Strings& out) const
71  -> void;
72 
73  auto move_char_suggest(std::string& word, List_Strings& out) const
74  -> void;
75 
76  auto bad_char_suggest(std::string& word, List_Strings& out) const
77  -> void;
78 
79  auto doubled_two_chars_suggest(std::string& word,
80  List_Strings& out) const -> void;
81 
82  auto two_words_suggest(const std::string& word, List_Strings& out) const
83  -> void;
84 
85  auto ngram_suggest(const std::string& word_u8, List_Strings& out) const
86  -> void;
87 
88  auto expand_root_word_for_ngram(Word_List::const_reference root,
89  std::string_view wrong,
90  List_Strings& expanded_list,
91  std::vector<bool>& cross_affix) const
92  -> void;
93 };
94 
95 } // namespace v5
96 } // namespace nuspell
97 #endif // NUSPELL_SUGGESTER_HXX
nuspell::v5::Suggester
Definition: suggester.hxx:27
nuspell::v5::Checker
Definition: checker.hxx:82
nuspell
Library main namespace.
Definition: aff_data.cxx:31