Crate harper_core

Source
Expand description

§harper-core

harper-core is the fundamental engine behind Harper, the grammar checker for developers.

harper-core is available on crates.io. However, improving the API is not currently a high priority. Feel free to use harper-core in your projects. If you run into issues, create a pull request.

§Features

concurrent: Whether to use thread-safe primitives (Arc vs Rc). Disabled by default. It is not recommended unless you need thread-safely (i.e. you want to use something like tokio).

Modules§

expr
An Expr is a declarative way to express whether a certain set of tokens fulfill a criteria.
language_detection
This module implements rudimentary, dictionary-based English language detection.
linting
Frameworks and rules that locate errors in text.
parsers
Adds support for parsing various programming and markup languages through a unified trait: Parser.
patterns
Patterns are one of the more powerful ways to query text inside Harper, especially for beginners. They are a simplified abstraction over Expr.
spell
Contains the relevant code for performing dictionary lookups and spellchecking (i.e. fuzzy dictionary lookups).

Structs§

AdverbData
Adverb can be a “junk drawer” category for words which don’t fit the other major categories. The typical adverbs are “adverbs of manner”, those derived from adjectives in -ly other adverbs (time, place, etc) should probably not be considered adverbs for Harper’s purposes
ConjunctionData
DeterminerData
Additional metadata for determiners
Document
A document containing some amount of lexed and parsed English text.
FatStringToken
Similar to a FatToken, but uses a String as the underlying store.
FatToken
A Token that holds its content as a fat Vec<char> rather than as a Span.
IgnoredLints
A structure that keeps track of lints that have been ignored by users.
LintContext
A location-agnostic structure that attempts to captures the context and content that a Lint occurred.
Lrc
A single-threaded reference-counting pointer. ‘Rc’ stands for ‘Reference Counted’.
Mask
Identifies portions of a char sequence that should not be ignored by Harper.
NounData
Number
Represents a written number.
PronounData
Quote
Span
A window in a char sequence.
Token
Represents a semantic, parsed component of a Document.
VerbData
WordMetadata

Enums§

Currency
A national or international currency
Degree
Degree is a property of adjectives: positive is not inflected Comparative is inflected with -er or comes after the word “more” Superlative is inflected with -est or comes after the word “most”
Dialect
A regional dialect.
OrdinalSuffix
Punctuation
TokenKind
The parsed value of a Token. Has a variety of queries available. If there is a query missing, it may be easy to implement by just calling the delegate_to_metadata macro.
VerbForm

Traits§

CharStringExt
Extensions to character sequences that make them easier to wrangle.
LSend
Masker
A Masker is a tool that can be composed to eliminate chunks of text from being parsed. They can be composed to do things like isolate comments from a programming language or disable linting for languages that have been determined to not be English.
TokenStringExt
Extension methods for Token sequences that make them easier to wrangle and query.
VecExt

Functions§

core_version
Return harper-core version
make_title_case
make_title_case_str
A helper function for make_title_case that uses Strings instead of char buffers.
remove_overlaps
A utility function that removes overlapping lints in a vector, keeping the more important ones.

Type Aliases§

CharString
A char sequence that improves cache locality. Most English words are fewer than 12 characters.