mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 06:14:22 +01:00
remove AI language thing.
This commit is contained in:
@@ -32,7 +32,6 @@ import (
|
||||
"github.com/go-text/typesetting/shaping"
|
||||
"github.com/nbd-wtf/emoji"
|
||||
"github.com/nfnt/resize"
|
||||
"github.com/pemistahl/lingua-go"
|
||||
"github.com/srwiley/rasterx"
|
||||
"golang.org/x/image/math/fixed"
|
||||
_ "golang.org/x/image/webp"
|
||||
@@ -71,7 +70,6 @@ var (
|
||||
language.Syriac,
|
||||
}
|
||||
|
||||
detector lingua.LanguageDetector
|
||||
scriptRanges []ScriptRange
|
||||
fontMap [nSupportedScripts]font.Face
|
||||
emojiFace font.Face
|
||||
@@ -127,21 +125,6 @@ type ScriptRange struct {
|
||||
}
|
||||
|
||||
func initializeImageDrawingStuff() error {
|
||||
// language detector
|
||||
if !s.SkipLanguageModel {
|
||||
detector = lingua.NewLanguageDetectorBuilder().FromLanguages(
|
||||
lingua.Japanese,
|
||||
lingua.Persian,
|
||||
lingua.Chinese,
|
||||
lingua.Thai,
|
||||
lingua.Hebrew,
|
||||
lingua.Arabic,
|
||||
lingua.Bengali,
|
||||
lingua.Hindi,
|
||||
lingua.Korean,
|
||||
).WithLowAccuracyMode().Build()
|
||||
}
|
||||
|
||||
// script detector material
|
||||
for _, srange := range language.ScriptRanges {
|
||||
for ssi, script := range supportedScripts {
|
||||
@@ -281,18 +264,7 @@ gotScriptIndex:
|
||||
script = supportedScripts[idx]
|
||||
face = fontMap[idx]
|
||||
direction := directionMap[idx]
|
||||
|
||||
lng := language.Language("en-us")
|
||||
if detector == nil {
|
||||
lng = defaultLanguageMap[idx]
|
||||
} else {
|
||||
lang, ok := detector.DetectLanguageOf(string(paragraph))
|
||||
if ok {
|
||||
lng = language.Language(lang.IsoCode639_1().String())
|
||||
} else {
|
||||
lng = defaultLanguageMap[idx]
|
||||
}
|
||||
}
|
||||
lng := defaultLanguageMap[idx]
|
||||
|
||||
return lng, script, direction, face
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user