First real commit. Setting up for full CI/CD and testing pipeline
This commit is contained in:
20
internal/reader/orp.go
Normal file
20
internal/reader/orp.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package reader
|
||||
|
||||
// ORPIndex calculates the approximate optimal recognition
|
||||
// point of a word.
|
||||
//
|
||||
// The returned value is a zero-based rune index.
|
||||
func ORPIndex(runes []rune) int {
|
||||
length := len(runes)
|
||||
|
||||
switch {
|
||||
case length <= 1:
|
||||
return 0
|
||||
case length <= 5:
|
||||
return 1
|
||||
case length <= 9:
|
||||
return 2
|
||||
default:
|
||||
return 3
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user