Documentation
¶
Overview ¶
Package languagetool is the library behind the languagetool command: the HTTP client, request shaping, and the typed data models for the LanguageTool API.
The public API at api.languagetool.org is open: no API key, no auth. This package wraps it with a rate-limited client that the kit operations consume.
Index ¶
Constants ¶
const DefaultUserAgent = "languagetool/dev (+https://github.com/tamnd/languagetool-cli)"
DefaultUserAgent identifies the client to LanguageTool.
const Host = "api.languagetool.org"
Host is the LanguageTool API hostname.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a rate-limited HTTP client for the LanguageTool API.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
}
Config holds constructor parameters for Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults for the LanguageTool public API.
type Domain ¶
type Domain struct{}
Domain is the LanguageTool driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Classify ¶
Classify turns any accepted input into the canonical (uriType, id). A language code (2-letter or IETF like en-US) maps to ("lang", input); anything else is treated as text to check and maps to ("text", input).
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme and the identity the single-site binary inherits.
type GrammarIssue ¶
type GrammarIssue struct {
Sentence string `kit:"id" json:"sentence"`
Offset int `json:"offset"`
Length int `json:"length"`
Message string `json:"message"`
ShortMessage string `json:"short_message"`
Replacements []string `json:"replacements"`
RuleID string `json:"rule_id"`
Category string `json:"category"`
IssueType string `json:"issue_type"`
Context string `json:"context"`
}
GrammarIssue is one grammar or style match from the LanguageTool check endpoint.