Cgo binding for libtextcat C library



Cgo binding for libtextcat C library. Guaranteed compatibility with version 2.2.


Installation consists of several simple steps. They may be a bit different on your target system (e.g. require more permissions) so adapt them to the parameters of your system.

Get libtextcat C library code

NOTE: If this link is not working or there are some problems with downloading, there is a stable version 2.2 snapshot saved in Downloads.

Build and install libtextcat C library

From the directory, where you unarchived libtextcat, run:

sudo make install
sudo ldconfig 

Install Go wrapper

go get
go test (must PASS)

Installation notes

Make sure that you have your local library paths set correctly and that installation was successful. Otherwise, go build or go test may fail.

libtextcat is installed in your local library directory (e.g. /usr/local/lib) and puts its libraries there. This path should be registered in your system (using ldconfig or exporting LD_LIBRARY_PATH, etc.) or the linker would fail.


cat, err := NewTextCat(ConfigPath) // See 'Usage notes' section

if nil != err {
    // ... Handle error ...
defer cat.Close()

matches, err := cat.Classify(text)

if nil != err {
    // ... Handle error ...

// Use matches. 
// NOTE: matches[0] is the best match.

Usage notes

libtextcat library needs to load language models to start guessing languages. These models are set using a configuration file and a number of language model (.lm) files.

Configuration file maps .lm files to identifiers used in the library. See example. Path to this file is specified in the NewTextCat call.

.lm files contain language patterns and frequencies for a specified language. See example. Paths to these files are specified in the config file above. They can be absolute or relative (to the caller).


To immediately get started, copy /defaultcfg folder contents to the directory of your target project and use:

cat, err := NewTextCat("defaultcfg/conf.txt")

This will give you a standard set of languages described in the Default configuration section below.

Default configuration

This package contains a default configuration (/defaultcfg) which is created to work in following conditions:

  • Utf-8 only languages
  • Language list is taken from snowball package
  • Language identifiers are the same as in snowball package

This configuration is meant to be used in pair with the snowball package.

More info

For more information on libtextcat refer to the original website, which contains links on theory and other details.

libtextcat Licence

The libtextcat library is released under the BSD Licence



The goodsign/libtextcat binding is released under the BSD Licence


Dmitry Bondarenko
Dmitry Bondarenko
The Simplest and worst logging library ever written

gologger A Simple Easy to use go logger library. Displays Colored log into console in any unix or windows platform. You can even store your logs in fi

Sadlil Rhythom 39 Jan 19, 2021
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs

gomol Gomol (Go Multi-Output Logger) is an MIT-licensed structured logging library for Go. Gomol grew from a desire to have a structured logging libra

Kristin Davidson 18 Dec 20, 2021
Minimalistic logging library for Go.

logger Minimalistic logging library for Go. Blog Post Features: Advanced output filters (package and/or level) Attributes Timers for measuring perform

Azer Koçulu 148 Nov 30, 2021
Seelog is a native Go logging library that provides flexible asynchronous dispatching, filtering, and formatting.

Seelog Seelog is a powerful and easy-to-learn logging framework that provides functionality for flexible dispatching, filtering, and formatting log me

Seelog project repository 1.6k Jan 12, 2022
A pure Go contextual logging library with "batteries included"

Cue Overview Cue implements contextual logging with "batteries included". It has thorough test coverage and supports logging to stdout/stderr, file, s

Bob Ziuchkovski 26 Sep 16, 2019
Golang logging library

Golang logging library Package logging implements a logging infrastructure for Go. Its output format is customizable and supports different logging ba

Örjan Fors 1.7k Jan 5, 2022
Library and program to parse and forward HAProxy logs

haminer Library and program to parse and forward HAProxy logs. Supported forwarder, Influxdb Requirements Go for building from source code git for dow

Shulhan 22 Mar 20, 2019
A flexible process data collection, metrics, monitoring, instrumentation, and tracing client library for Go

Package monkit is a flexible code instrumenting and data collection library. See documentation at S

Space Monkey Go 461 Dec 28, 2021
Hierarchical, leveled, and structured logging library for Go

spacelog Please see for info License Copyright (C) 2014 Space Monkey, Inc. Licensed under the Apach

Space Monkey Go 98 Apr 27, 2021

Tideland Go Library Description The Tideland Go Library contains a larger set of useful Google Go packages for different purposes. ATTENTION: The cell

Tideland 195 Dec 16, 2021
OpenTelemetry log collection library

opentelemetry-log-collection Status This project was originally developed by observIQ under the name Stanza. It has been contributed to the OpenTeleme

OpenTelemetry - CNCF 71 Jan 15, 2022
Simple and extensible monitoring agent / library for Kubernetes:

Satellite Satellite is an agent written in Go for collecting health information in a kubernetes cluster. It is both a library and an application. As a

Teleport 192 Dec 24, 2021
Minimal structured logging library for Go

slog slog is a minimal structured logging library for Go. Install go get Features Minimal API First class context.Context support First c

Coder 233 Jan 10, 2022
Litter is a pretty printer library for Go data structures to aid in debugging and testing.

Litter Litter is a pretty printer library for Go data structures to aid in debugging and testing. Litter is provided by Sanity: The Headless CMS Const

Sanity 1.3k Jan 15, 2022
User-friendly Go library for building Grafana dashboards

Grabana Grabana provides a developer-friendly way of creating Grafana dashboards. Whether you prefer writing code or YAML, if you are looking for a wa

Kévin Gomez 401 Jan 19, 2022
OS system statistics library for Go

OS system statistics library for Go This is a library to get system metrics like cpu load and memory usage. The library is created for mackerel-agent.

Mackerel 192 Jan 23, 2022
GoVector is a vector clock logging library written in Go.

GoVector is a vector clock logging library written in Go. The vector clock algorithm is used to order events in distributed systems in the absence of a centralized clock. GoVector implements the vector clock algorithm and provides feature-rich logging and encoding infrastructure.

Distributed clocks 158 Dec 23, 2021
Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.

Noodlog Summary Noodlog is a Golang JSON parametrized and highly configurable logging library. It allows you to: print go structs as JSON messages; pr

Gyoza Tech 35 Dec 29, 2021
Cloud logging library in golang

?? logg Open Source Cloud logging library in Go. About the project Connect your golang microservices logs with this engine! Send your logs to kafka, r

yuri 3 Nov 8, 2021