Go port of yoeo/guesslang. Detects programming language of source code using a deep learning model.
Requires libtensorflow
C API.
On macOS, it can be installed with homebrew:
brew install libtensorflow
Alternatively, for Linux-based systems:
script/install-libtensorflow
go get github.com/robherley/guesslang-go
See example usage in examples/main.go
To work around some of the limitations of the Go TensorFlow bindings (and the wrapper library)1, the SavedModel is embeded in the binary and
when a Guesser
is initialized, it temporarily writes the model to a directory (and removes it after).
So, in order to use this package, you must at least have a writeable temporary directory that aligns with Go's os.TempDir()
.
Powered by:
- yoeo/guesslang: language model
- tensorflow/tensorflow: TensorFlow
- galeone/tfgo: TensorFlow in Go
Inspired by: