Nuspell
spell checker
Classes | Typedefs | Enumerations | Functions | Variables
nuspell Namespace Reference

Library main namespace. More...

Classes

class  Encoding
 
struct  Aff_Data
 
class  At_Scope_Exit
 
class  To_Root_Unroot_RAII
 
struct  Affixing_Result_Base
 
struct  Affixing_Result
 
struct  Affixing_Result< T1, void >
 
struct  Affixing_Result< void, void >
 
struct  Compounding_Result
 
struct  Checker
 
class  Dictionary_Loading_Error
 The only important public exception. More...
 
class  Dictionary
 The only important public class. More...
 
class  Dict_Finder_For_CLI_Tool
 Don't use this except from Nuspell CLI tool. More...
 
class  Dict_Finder_For_CLI_Tool_2
 Don't use this except from Nuspell CLI tool. More...
 
class  Subrange
 
class  String_Set
 
class  Substr_Replacer
 
class  Break_Table
 
struct  identity
 
class  Hash_Multimap
 
struct  Condition_Exception
 
class  Condition
 
struct  Prefix
 
struct  Suffix
 
class  Prefix_Multiset
 
class  Reversed_String_View
 
struct  String_Reverser
 
struct  Extractor_Of_Appending_From_Affix
 
class  Prefix_Table
 
class  Suffix_Table
 
class  String_Pair
 
struct  Compound_Pattern
 
class  Compound_Rule_Table
 
class  Replacement_Table
 
struct  Similarity_Group
 
class  Phonetic_Table
 
struct  Suggester
 
struct  U8_CP_Pos
 
class  U8_Encoded_CP
 
struct  Idx_And_Next_CP
 
struct  Idx_And_Prev_CP
 
struct  Write_CP_Idx_and_Error
 
struct  Idx_And_Next_CP_Valid
 
struct  Idx_And_Prev_CP_Valid
 
class  Encoding_Converter
 

Typedefs

using Word_List = Hash_Multimap< std::string, Flag_Set >
 
using Flag_Set = String_Set< char16_t >
 
template<class T , class Key_Extr = identity>
using Suffix_Multiset = Prefix_Multiset< T, Key_Extr, String_Reverser< typename Prefix_Multiset< T, Key_Extr >::Char_Type > >
 
using List_Strings = std::vector< std::string >
 

Enumerations

enum class  Flag_Type { SINGLE_CHAR , DOUBLE_CHAR , NUMBER , UTF8 }
 
enum  Affixing_Mode { FULL_WORD , AT_COMPOUND_BEGIN , AT_COMPOUND_END , AT_COMPOUND_MIDDLE }
 
enum class  Casing : char {
  SMALL , INIT_CAPITAL , ALL_CAPITAL , CAMEL ,
  PASCAL
}
 

Functions

auto match_compound_pattern (const Compound_Pattern &p, string_view word, size_t i, Compounding_Result first, Compounding_Result second)
 
auto is_compound_forbidden_by_patterns (const vector< Compound_Pattern > &patterns, string_view word, size_t i, Compounding_Result first, Compounding_Result second)
 
auto are_three_code_points_equal (string_view word, size_t i) -> bool
 
template<class AffixT >
auto is_modiying_affix (const AffixT &a)
 
template<class AffixInner , class AffixOuter >
auto cross_valid_inner_outer (const AffixInner &inner, const AffixOuter &outer)
 
template<class Affix >
auto cross_valid_inner_outer (const Flag_Set &word_flags, const Affix &afx)
 
auto append_default_dir_paths (vector< fs::path > &paths) -> void
 Append the paths of the default directories to be searched for dictionaries. More...
 
auto append_libreoffice_dir_paths (vector< fs::path > &paths) -> void
 Append the paths of the LibreOffice's directories to be searched for dictionaries. More...
 
auto search_dirs_for_one_dict (const vector< fs::path > &dir_paths, const fs::path &dict_name_stem) -> fs::path
 Serach the directories for only one dictionary. More...
 
 catch (const fs::filesystem_error &)
 
auto search_dirs_for_dicts (const vector< fs::path > &dir_paths, vector< fs::path > &dict_list) -> void
 Search the directories for dictionaries. More...
 
auto search_default_dirs_for_dicts () -> vector< fs::path >
 Search the default directories for dictionaries. More...
 
auto append_default_dir_paths (std::vector< std::string > &paths) -> void
 
auto append_libreoffice_dir_paths (std::vector< std::string > &paths) -> void
 
auto search_dir_for_dicts (const string &dir_path, vector< pair< string, string >> &dict_list) -> void
 
auto search_dirs_for_dicts (const std::vector< string > &dir_paths, std::vector< std::pair< string, string >> &dict_list) -> void
 
auto search_default_dirs_for_dicts (std::vector< std::pair< std::string, std::string >> &dict_list) -> void
 
auto find_dictionary (const std::vector< std::pair< std::string, std::string >> &dict_list, const std::string &dict_name) -> std::vector< std::pair< std::string, std::string >>::const_iterator
 
NUSPELL_BEGIN_INLINE_NAMESPACE NUSPELL_EXPORT auto append_default_dir_paths (std::vector< std::filesystem::path > &paths) -> void
 
NUSPELL_EXPORT auto append_libreoffice_dir_paths (std::vector< std::filesystem::path > &paths) -> void
 
NUSPELL_EXPORT auto search_dirs_for_one_dict (const std::vector< std::filesystem::path > &dir_paths, const std::filesystem::path &dict_name_stem) -> std::filesystem::path
 
NUSPELL_EXPORT auto search_dirs_for_dicts (const std::vector< std::filesystem::path > &dir_paths, std::vector< std::filesystem::path > &dict_list) -> void
 
NUSPELL_DEPRECATED_EXPORT auto search_dir_for_dicts (const std::string &dir_path, std::vector< std::pair< std::string, std::string >> &dict_list) -> void
 
NUSPELL_DEPRECATED_EXPORT auto search_dirs_for_dicts (const std::vector< std::string > &dir_paths, std::vector< std::pair< std::string, std::string >> &dict_list) -> void
 
template<class Range >
 Subrange (const Range &r) -> Subrange< typename Range::const_iterator >
 
template<class Range >
 Subrange (Range &r) -> Subrange< typename Range::iterator >
 
template<class CharT >
auto swap (String_Set< CharT > &a, String_Set< CharT > &b)
 
template<class DataIter , class PatternIter , class FuncEq = std::equal_to<>>
auto match_simple_regex (DataIter data_first, DataIter data_last, PatternIter pat_first, PatternIter pat_last, FuncEq eq=FuncEq())
 
template<class DataRange , class PatternRange , class FuncEq = std::equal_to<>>
auto match_simple_regex (const DataRange &data, const PatternRange &pattern, FuncEq eq=FuncEq())
 
auto match_compund_rule (const std::vector< const Flag_Set * > &words_data, const std::u16string &pattern)
 
auto & operator|= (Suggester::High_Quality_Sugs &lhs, Suggester::High_Quality_Sugs rhs)
 
auto u8_is_cp_error (int32_t cp) -> bool
 
template<class Range >
auto u8_advance_cp (const Range &str, size_t &i, int32_t &cp) -> void
 
template<class Range >
auto u8_advance_index (const Range &str, size_t &i) -> void
 
template<class Range >
auto u8_reverse_cp (const Range &str, size_t &i, int32_t &cp) -> void
 
template<class Range >
auto u8_reverse_index (const Range &str, size_t &i) -> void
 
template<class Range >
auto u8_write_cp_and_advance (Range &buf, size_t &i, int32_t cp, bool &error) -> void
 
template<class Range >
auto valid_u8_advance_cp (const Range &str, size_t &i, char32_t &cp) -> void
 
template<class Range >
auto valid_u8_advance_index (const Range &str, size_t &i) -> void
 
template<class Range >
auto valid_u8_reverse_cp (const Range &str, size_t &i, char32_t &cp) -> void
 
template<class Range >
auto valid_u8_reverse_index (const Range &str, size_t &i) -> void
 
template<class Range >
auto valid_u8_write_cp_and_advance (Range &buf, size_t &i, char32_t cp) -> void
 
auto u16_is_cp_error (int32_t cp) -> bool
 
template<class Range >
auto u16_advance_cp (const Range &str, size_t &i, int32_t &cp) -> void
 
template<class Range >
auto u16_advance_index (const Range &str, size_t &i) -> void
 
template<class Range >
auto u16_reverse_cp (const Range &str, size_t &i, int32_t &cp) -> void
 
template<class Range >
auto u16_reverse_index (const Range &str, size_t &i) -> void
 
template<class Range >
auto u16_write_cp_and_advance (Range &buf, size_t &i, int32_t cp, bool &error) -> void
 
template<class Range >
auto valid_u16_advance_cp (const Range &str, size_t &i, char32_t &cp) -> void
 
template<class Range >
auto valid_u16_advance_index (const Range &str, size_t &i) -> void
 
template<class Range >
auto valid_u16_reverse_cp (const Range &str, size_t &i, char32_t &cp) -> void
 
template<class Range >
auto valid_u16_reverse_index (const Range &str, size_t &i) -> void
 
template<class Range >
auto valid_u16_write_cp_and_advance (Range &buf, size_t &i, char32_t cp) -> void
 
auto u8_swap_adjacent_cp (std::string &str, size_t i1, size_t i2, size_t i3) -> size_t
 
auto u8_swap_cp (std::string &str, U8_CP_Pos pos1, U8_CP_Pos pos2) -> std::pair< size_t, size_t >
 
template<class Range >
auto u8_next_cp (const Range &str, size_t i) -> Idx_And_Next_CP
 
template<class Range >
auto u8_next_index (const Range &str, size_t i) -> size_t
 
template<class Range >
auto u8_prev_cp (const Range &str, size_t i) -> Idx_And_Prev_CP
 
template<class Range >
auto u8_prev_index (const Range &str, size_t i) -> size_t
 
template<class Range >
auto u8_write_cp (Range &buf, size_t i, int32_t cp) -> Write_CP_Idx_and_Error
 
template<class Range >
auto valid_u8_next_cp (const Range &str, size_t i) -> Idx_And_Next_CP_Valid
 
template<class Range >
auto valid_u8_next_index (const Range &str, size_t i) -> size_t
 
template<class Range >
auto valid_u8_prev_cp (const Range &str, size_t i) -> Idx_And_Prev_CP_Valid
 
template<class Range >
auto valid_u8_prev_index (const Range &str, size_t i) -> size_t
 
template<class Range >
auto valid_u8_write_cp (Range &buf, size_t i, int32_t cp) -> size_t
 
NUSPELL_BEGIN_INLINE_NAMESPACE auto split_on_any_of (std::string_view, const char *, std::vector< std::string > &out) -> std::vector< std::string > &
 
auto utf32_to_utf8 (std::u32string_view in, std::string &out) -> void
 
auto utf32_to_utf8 (std::u32string_view in) -> std::string
 
auto valid_utf8_to_32 (std::string_view in, std::u32string &out) -> void
 
auto valid_utf8_to_32 (std::string_view in) -> std::u32string
 
auto utf8_to_16 (std::string_view in) -> std::u16string
 
bool utf8_to_16 (std::string_view in, std::u16string &out)
 
bool validate_utf8 (string_view s)
 
auto is_all_ascii (std::string_view s) -> bool
 
auto latin1_to_ucs2 (std::string_view s) -> std::u16string
 
auto latin1_to_ucs2 (std::string_view s, std::u16string &out) -> void
 
auto is_all_bmp (std::u16string_view s) -> bool
 
auto to_upper_ascii (std::string &s) -> void
 
auto to_upper (std::string_view in, const icu::Locale &loc) -> std::string
 
auto to_title (std::string_view in, const icu::Locale &loc) -> std::string
 
auto to_lower (std::string_view in, const icu::Locale &loc) -> std::string
 
auto to_upper (string_view in, const icu::Locale &loc, string &out) -> void
 
auto to_title (string_view in, const icu::Locale &loc, string &out) -> void
 
auto to_lower (u32string_view in, const icu::Locale &loc, u32string &out) -> void
 
auto to_lower (string_view in, const icu::Locale &loc, string &out) -> void
 
auto to_lower_char_at (std::string &s, size_t i, const icu::Locale &loc) -> void
 
auto to_title_char_at (std::string &s, size_t i, const icu::Locale &loc) -> void
 
auto classify_casing (string_view s) -> Casing
 
auto has_uppercase_at_compound_word_boundary (string_view word, size_t i) -> bool
 
auto replace_ascii_char (string &s, char from, char to) -> void
 
auto erase_chars (string &s, string_view erase_chars) -> void
 
auto is_number (string_view s) -> bool
 
auto count_appereances_of (string_view haystack, string_view needles) -> size_t
 
auto validate_utf8 (std::string_view s) -> bool
 
auto to_upper (std::string_view in, const icu::Locale &loc, std::string &out) -> void
 
auto to_title (std::string_view in, const icu::Locale &loc, std::string &out) -> void
 
auto to_lower (std::u32string_view in, const icu::Locale &loc, std::u32string &out) -> void
 
auto to_lower (std::string_view in, const icu::Locale &loc, std::string &out) -> void
 
NUSPELL_EXPORT auto classify_casing (std::string_view s) -> Casing
 
auto has_uppercase_at_compound_word_boundary (std::string_view word, size_t i) -> bool
 
auto replace_ascii_char (std::string &s, char from, char to) -> void
 
auto erase_chars (std::string &s, std::string_view erase_chars) -> void
 
NUSPELL_EXPORT auto is_number (std::string_view s) -> bool
 
auto count_appereances_of (std::string_view haystack, std::string_view needles) -> size_t
 
auto begins_with (std::string_view haystack, std::string_view needle) -> bool
 
auto ends_with (std::string_view haystack, std::string_view needle) -> bool
 
template<class T >
auto begin_ptr (T &x)
 
template<class T >
auto end_ptr (T &x)
 

Variables

constexpr NUSPELL_BEGIN_INLINE_NAMESPACE auto u8_max_cp_length = U8_MAX_LENGTH
 
constexpr auto u16_max_cp_length = U16_MAX_LENGTH
 

Detailed Description

Library main namespace.

Function Documentation

◆ append_default_dir_paths()

auto nuspell::append_default_dir_paths ( vector< fs::path > &  paths) -> void

Append the paths of the default directories to be searched for dictionaries.

Parameters
[out]pathsvector that receives the directory paths

◆ append_libreoffice_dir_paths()

auto nuspell::append_libreoffice_dir_paths ( vector< fs::path > &  paths) -> void

Append the paths of the LibreOffice's directories to be searched for dictionaries.

Warning
This function shall not be called from LibreOffice or modules that may end up being used by LibreOffice. It is mainly intended to be used by the CLI tool.
Parameters
[out]pathsvector that receives the directory paths

◆ search_default_dirs_for_dicts()

NUSPELL_EXPORT auto nuspell::search_default_dirs_for_dicts ( ) -> vector< fs::path >

Search the default directories for dictionaries.

This is just a convenience that call two other functions.

See also
append_default_dir_paths()
search_dirs_for_dicts()
Returns
vector with the paths of the .aff files of the found dictionaries

◆ search_dirs_for_dicts()

auto nuspell::search_dirs_for_dicts ( const vector< fs::path > &  dir_paths,
vector< fs::path > &  dict_list 
) -> void

Search the directories for dictionaries.

This function searches the directories for files that represent dictionaries and for each found dictionary it appends the path of the .aff file to dict_list. One dictionary consts of two files, .aff and .dic, and both need to exist, but only the .aff is added.

Parameters
[in]dir_pathslist of paths to directories
[out]dict_listvector that receives the paths of the found dictionaries

◆ search_dirs_for_one_dict()

auto nuspell::search_dirs_for_one_dict ( const vector< fs::path > &  dir_paths,
const fs::path &  dict_name_stem 
) -> fs::path

Serach the directories for only one dictionary.

This function is more efficient than search_dirs_for_dicts() because it does not iterate whole directories, it only checks the existance of .dic and .aff files. Useful for some CLI tools. GUI apps generally need a list of all dictionaries.

Parameters
[in]dir_pathslist of directories
[in]dict_name_stemdictionary name, filename without extension (stem)
Returns
path to the .aff file of the dictionary or empty object if not found