Documentation
¶
Index ¶
- Constants
- Variables
- func CorrectMatches(text string, matches []*Match) string
- func CorrectMatchesBytes(text []byte, matches []*Match) []byte
- func Validate(text string) bool
- func ValidateErr(text string) error
- type BotInfo
- type BotWarnings
- type DetectedLanguage
- type GrammarBot
- type Match
- type MatchContext
- type MatchReplacement
- type MatchRule
- type MatchType
- type RequestLanguage
- type Response
- type RuleCategory
Constants ¶
View Source
const MaxLength = 50000
Variables ¶
View Source
var ErrEmpty = errors.New("Text is empty.")
View Source
var ErrExceedLimits = errors.New("Text longer than 50,000 characters is not allowed.")
Functions ¶
func CorrectMatches ¶
CorrectMatches - returns corrected text with first replacements in matches
func CorrectMatchesBytes ¶
CorrectMatchesBytes - returns corrected text with first replacements in matches
func ValidateErr ¶
Types ¶
type BotWarnings ¶
type BotWarnings struct {
IncompleteResults bool `json:"incompleteResults"`
}
type DetectedLanguage ¶
type GrammarBot ¶
type GrammarBot struct { Language string ApiKey string BaseURI string Version string ApiName string Client *http.Client }
func New ¶
func New(apiKey string) *GrammarBot
func (GrammarBot) Check ¶
func (api GrammarBot) Check(text string) (*Response, error)
Check - Check a given piece of text for grammatical errors.
func (GrammarBot) CheckBytes ¶
func (api GrammarBot) CheckBytes(text []byte) (*Response, error)
CheckBytes - Check a given piece of text for grammatical errors.
type Match ¶
type Match struct { Message string `json:"message"` ShortMessage string `json:"shortMessage"` Replacements []MatchReplacement `json:"replacements"` Offset int `json:"offset"` Length int `json:"length"` Context MatchContext `json:"context"` Sentence string `json:"sentence"` Type MatchType `json:"type"` Rule *MatchRule `json:"rule"` }
type MatchContext ¶
type MatchReplacement ¶
type MatchReplacement struct {
Value string `json:"value"`
}
type MatchRule ¶
type MatchRule struct { ID string `json:"id"` Description string `json:"description"` IssueType string `json:"issueType"` Category RuleCategory `json:"category"` }
type RequestLanguage ¶
type RequestLanguage struct { Name string `json:"name"` Code string `json:"code"` Detected DetectedLanguage `json:"detectedLanguage"` }
type Response ¶
type Response struct { Software BotInfo `json:"software"` Warnings BotWarnings `json:"warnings"` Language RequestLanguage `json:"language"` Matches []*Match `json:"matches"` }
func CheckBytes ¶
CheckBytes - Check a given piece of text for grammatical errors.
type RuleCategory ¶
Click to show internal directories.
Click to hide internal directories.