Skip to content

Swahili instead of German #82

@ceving

Description

@ceving

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions