Skip to content

Swahili instead of German #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ceving opened this issue Apr 16, 2025 · 0 comments
Open

Swahili instead of German #82

ceving opened this issue Apr 16, 2025 · 0 comments

Comments

@ceving
Copy link

ceving commented Apr 16, 2025

I have the following text:

Ein neues Korpus mit Stichtag Juli 2012 wurde Ende des Jahres zugänglich gemacht.

and the following program:

package main

import (
	"fmt"
	"github.com/pemistahl/lingua-go"
	"os"
)

func main() {
	detector := lingua.NewLanguageDetectorBuilder().
		FromAllLanguages().
		Build()
	text, err := os.ReadFile(os.Args[1])
	if err != nil {
		panic(err)
	}
	stext := string(text)
	for _, result := range detector.DetectMultipleLanguagesOf(stext) {
		fmt.Printf("%s: '%s'\n", result.Language(), stext[result.StartIndex():result.EndIndex()])
	}
}

The output is:

German: 'Ein neues Korpus mit '
Swahili: 'Stichtag Juli '
German: '2012 wurde Ende des Jahres zugänglich gemacht.
'

How to work around such problems?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant