pemistahl / lingua-go

The most accurate natural language detection library for Go, suitable for short text and mixed-language text
Apache License 2.0
1.18k stars 66 forks source link

Reduce "bloat" #8

Closed dim closed 2 years ago

dim commented 2 years ago

Hi,

Thanks for the excellent work first and foremost, but may I suggest keeping metadata (e.g. https://github.com/pemistahl/lingua-go/commit/61c7054b215d4252f65ae35959b8587acab9927a) separately, outside this repository. You could create another repo, e.g. github.com/pemistahl/lingua-go-accuracy-reports or similar.

The comparisons are useful but also currently bloat the repository, plus they introduce quite a few extra dependencies, i.e. https://github.com/pemistahl/lingua-go/blob/main/go.sum.

What do you think?

BoeingX commented 2 years ago

Hi,

Thanks for this great library, and I share the same opinion as @dim . The dependency on whatlanggo and gocld3 is not strictly necessary, and it introduces extra difficulties when using lingua-go.

For example, I've a language detector using gocld3, and would like to add lingua-go as an extra backend, however, due to the dependency on gocld3, I need to upgrade the version of gocld3 in my project which implies some (painful) extra work (in particular, upgrade the protobuf library).

Is it possible to separate the cmd from the library itself? Apart from the one suggested @dim , simply creating a go.mod in the cmd should also do the job (here is an example).

Looking forward to your feedback!

Regards

pemistahl commented 2 years ago

Hi @dim and @BoeingX, thank you for reminding me of this unfortunate problem. I wasn't too familiar with Go modules at the time I wrote the library. I've now created a separate Go module within the cmd/ subdirectory and separated the dependencies for creating the accuracy reports. If you just want to use my library, gocld3 and Whatlanggo should not be downloaded automatically anymore. I will release version 1.0.5 soon which includes the fix.

Thank you very much for using my library. Very much appreciated. :)