package main import ( "unicode" ) func IsChinese(str string) bool { count_chinese := 0 count_no_chinese := 0 for _, char := range str { if unicode.Is(unicode.Han, char) { count_chinese++ } else { if !unicode.IsSpace(char) { count_no_chinese++ } } } // >= 10% of the text is chinese if count_chinese >= count_no_chinese/10 { return true } return false }