fonetic-go
assess pronounciblity of text
Introduction
Fonetic is a library to assess pronounceablility of a given text. For more information, check out the original python implementation.
Documentation
package main
import (
"github.com/s0md3v/fonetic-go"
)
/*
This is just an example, don't copy-paste this. Use fonetic.Count's output according to your needs.
*/
func main(){
total, good, bad := fonetic.Count("your string here")
if (good/total) > 70 || (bad == 0 && total < 2)) {
fmt.Println("TEXT")
} else {
fmt.Println("RANDOM")
}
}
Where,
- total: total number of bigrams
- good: number of pronounceable bigrams
- bad: number of non-pronounceable bigrams
Note: Non-alphabetic characters do not count as
good
orbad
, but they do count intotal
. It means the output foraa1323423634
would betotal=11,good=1,bad=0
.