Skip to content

Latest commit

 

History

History
48 lines (40 loc) · 1.5 KB

README.md

File metadata and controls

48 lines (40 loc) · 1.5 KB

grammar

Build Status Coverage Status codecov GoCover Go Report Card GoDoc

@_grammar_ might correct your grammar on Twitter!

This is a parser that corrects some specific common grammar errors.

License

The code is licensed under a modified version of the AGPL. See LICENSE.txt and agpl-3.0.txt for more details.

Example

package main

import (
	"victorz.ca/grammar"

	"fmt"
)

func runTest(s string) (undetected bool) {
	r := grammar.MakeTweetReply(s, "@")
	if r == "" {
		r = "(No errors detected!)"
		undetected = true
	}
	fmt.Println(r)
	return
}

func main() {
	for _, test := range [...]string{
		"Nothing's wrong with this sentence.",
		"But it's true that their is a problem with this sentence.",
	} {
		for i := 0; i < 20; i++ {
			if runTest(test) {
				break
			}
		}
	}
}