GreatDocs.spell_check()
Check spelling in documentation files and optionally docstrings.
Usage
GreatDocs.spell_check(
include_docs=True,
include_docstrings=False,
custom_dictionary=None,
language="en",
verbose=False
)In practice, you would normally use the great-docs spell-check CLI command rather than calling this method directly. See the CLI reference for details.
This method scans documentation files (.qmd, .md) for spelling errors using a dictionary-based approach. It intelligently skips code blocks, inline code, URLs, and common technical terms.
Parameters
include_docs: bool = True-
If
True, scan documentation files (.qmd,.md) for spelling errors. Default isTrue. include_docstrings: bool = False-
If
True, also scan Python docstrings in the package. Default isFalse. custom_dictionary: list[str] | None = None-
List of additional words to consider correct (e.g., project-specific terms, library names). Default is
None. language: str = "en"-
Language for spell checking. Currently supports “en” (English). Default is
"en". verbose: bool = False-
If
True, print detailed progress information. Default isFalse.
Returns
dict-
A dictionary containing:
total_words: total number of words checkedmisspelled: list of dicts withword,suggestions,files,contextsby_file: dict mapping file paths to misspelled words in each fileskipped_files: list of files that couldn’t be read
Examples
Check spelling in documentation:
from great_docs import GreatDocs
docs = GreatDocs()
results = docs.spell_check()
print(f"Checked {results['total_words']} words")
print(f"Misspelled: {len(results['misspelled'])}")
for item in results['misspelled']:
print(f" {item['word']}: {item['suggestions'][:3]}")Check with custom dictionary:
results = docs.spell_check(
custom_dictionary=["griffe", "docstring", "navbar"]
)