Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please document basic usage #156

Open
GaussianZero opened this issue Jun 22, 2019 · 2 comments
Open

Please document basic usage #156

GaussianZero opened this issue Jun 22, 2019 · 2 comments

Comments

@GaussianZero
Copy link

I can't get the basic hello world example to work, maybe I'm just being dense? Can you please document how to use this library for the simple use case of correcting a word that is misspelled?


import (
  "fmt"
  "github.com/client9/misspell"
)

func main() {
  fmt.Println("hello")

  r := misspell.New()

  result, diffs := r.Replace("whlie")
  fmt.Println(result)
  fmt.Println(diffs)
  for _, d := range diffs {
    fmt.Println(d)
  }
}

Results:

hello
whlie
[]

@GaussianZero
Copy link
Author

I would expect this to correct "whlie" -> "while"

@GaussianZero
Copy link
Author

Just realized that the rule of "whlie" -> "while" is not in this library, so perhaps this is "working as intended"? The above code works with "langauge" -> "language"

This seems like a bit of a miss from this library (i.e. shouldn't mispellings one or two edit distance away be picked up as misspellings?) I can do this on my own of course, but I'd prefer this library do it for me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant