remove AI language thing.

This commit is contained in:
fiatjaf
2024-09-24 11:48:15 -03:00
parent fca2d6a9c1
commit 7405cc2b75
5 changed files with 5 additions and 40 deletions

View File

@@ -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
}