Vadim Markovtsev, source{d}.
Vadim Markovtsev, source{d}
Classic approach
Our approach
import (
"gopkg.in/bblfsh/client-go.v2"
"gopkg.in/bblfsh/client-go.v2/tools"
)
client, _ := bblfsh.NewClient("0.0.0.0:9432")
resp, _ := client.NewParseRequest().Content("...").Do()
nodes, err := tools.Filter(resp.UAST, "//*[@roleComment]")
// nodes[0].Token
Production pipeline:
modelBytes, _ := assets.Asset("model.pb")
graph := tf.NewGraph()
graph.Import(modelBytes, "")
input := graph.Operation("input").Output(0)
output := graph.Operation("output").Output(0)
sess, _ := tf.NewSession(graph, &tf.SessionOptions{})
feed, _ := tf.NewTensor([][]float32{})
result, _ := sess.Run(
map[tf.Output]*tf.Tensor{input: input1},
[]tf.Output{output}, nil)
echo "When I wrote this, only God and I understood \
what I was doing. Now, God only knows" | $GOPATH/bin/sentiment
0.8803515
echo "sometimes I believe compiler ignores \
all my comments" | $GOPATH/bin/sentiment
0.88705057
echo "drunk, fix later" | $GOPATH/bin/sentiment
0.08034721
# install and run bblfshd
# install hercules
# install libtensorflow
hercules --sentiment https://github.com/golang/go
Project | Positive | Negative | Effective |
---|---|---|---|
pygame/pygame | 93.4 | 98.2 | -4.8 |
pallets/flask | 23.6 | 31.9 | -8.3 |
django/django | 462.1 | 536.1 | -74.0 |
golang/go | 402.1 | 507.3 | -105.2 |
kubernetes/kubernetes | 186.1 | 91.6 | 94.5 |
keras-team/keras | 104.8 | 71.1 | 33.7 |
My contacts:
#MLonCode
It is low-level, old, and unused by Go's current HTTP stack
not clear why this shouldn't work
overflow causes something awful
quiet expected TLS handshake error remote error: bad certificate