mogemimi / typopoi

A spell checker for static code analysis written in modern C++ :paw_prints: :mag:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typopoi

TypoPoi is a spell checker written in C++14. It provides a library and a standalone tool to easily find spelling mistakes in a text/source code. The library was designed for use with static code analysis tools.

TypoPoi is also open source and distributed under the MIT License. Feel free to fork, submit a pull request or modify anywhere you like!

Spell checking library

The spell checking library is a fast, easy-to-use, has no dependencies. It is constituted of the following files:

  • SpellChecker.h
  • SpellChecker.cpp

Usage

#include "SpellChecker.h"
typopoi::SpellChecker spellChecker;
spellChecker.AddWord(u8"defer");
spellChecker.AddWord(u8"deferred");
spellChecker.AddWord(u8"refer");
spellChecker.AddWord(u8"referred");
spellChecker.AddWord(u8"reference");

auto word = u8"defered";
auto result = spellChecker.Suggest(word);

if (result.correctlySpelled) {
    std::cout << "The word '" << word << "' is correctly spelled" << std::endl;
}

std::cout << "Did you mean:" << std::endl;
for (auto & suggestion : result.suggestions) {
    std::cout << suggestion << std::endl;
}

To detect spelling errors in your code, you can specify the identifiers (which denote functions, variables and types etc.) directly:

// Did you mean: "GetDeferredRenderer" or "GetDeferRenderer"
spellChecker.Suggest(u8"GetDeferedRenderer");

// Did you mean: "reference_count"
spellChecker.Suggest(u8"refrence_count");

Thanks

The following libraries and/or open source projects were used in typopoi:

About

A spell checker for static code analysis written in modern C++ :paw_prints: :mag:


Languages

Language:C++ 100.0%