https://github.com/nstr/go-nlang
Natural language processing for Go
https://github.com/nstr/go-nlang
go golang natural-language-processing
Last synced: about 1 year ago
JSON representation
Natural language processing for Go
- Host: GitHub
- URL: https://github.com/nstr/go-nlang
- Owner: nstr
- Created: 2017-01-21T20:46:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-16T21:04:12.000Z (almost 9 years ago)
- Last Synced: 2025-03-24T06:54:36.891Z (over 1 year ago)
- Topics: go, golang, natural-language-processing
- Language: Go
- Size: 3.91 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-nlang
Natural language processing for Go
* [Distance](#distance)
* [Phonetics](#phonetics)
* [To Do](#to-do)
## Distance
```go
import (
"fmt"
"github.com/njnest/go-nlang/distance"
)
func main() {
distanceText1 := "hi"
distanceText2 := "hello"
distanceText3 := "hello, my darling"
distanceTextResult := "comparison of '%s' & '%s'. Result is %f \n"
fmt.Printf(distanceTextResult, distanceText1, distanceText2, distance.Compare(distanceText1, distanceText2))
//comparison of 'hi' & 'hello'. Result is 0.000000
fmt.Printf(distanceTextResult, distanceText2, distanceText3, distance.Compare(distanceText2, distanceText3))
//comparison of 'hello' & 'hello, my darling'. Result is 0.444444
fmt.Printf(distanceTextResult, distanceText3, distanceText3, distance.Compare(distanceText3, distanceText3))
//comparison of 'hello, my darling' & 'hello, my darling'. Result is 1.000000
}
```
## Phonetics
```go
import (
"fmt"
"github.com/njnest/go-nlang/phonetics"
)
func main() {
ph, res := phonetics.Compare("New Zeland it is part of Feladelfia", "New Zeland it is part of Pheladelphia")
fmt.Println("Sentences sound the same:", res)
fmt.Println("Sentences contain the same sounds:", ph.SentencesСontainTheSameWords())
}
```
## To Do
1. tokenizers
2. frequency
3. tf-idf