Giter VIP home page Giter VIP logo

bidisentiment's Introduction

BiDiSentiment GoDoc Build Status

Text sentiment analyser for Go and Python.

Runs on top of Tensorflow. The architecture is a bidirectional two-level character LSTM.

Happy and sad gophers

Installation of the inference module

go get gopkg.in/vmarkovtsev/BiDiSentiment.v1/...

Usage of the inference module

For every line in stdin, the command line tool prints the probability of the negative sentiment (the probability of the positive sentiment is 1 - negative).

echo "This is the worst movie I have ever seen, it sucks balls!" | sentiment 
0.9961139
echo "This is the best movie I have ever seen, just love it!" | sentiment
0.000769752

API expects string batches for performance reasons:

import "gopkg.in/vmarkovtsev/BiDiSentiment.v1"

func main() {
  session, _ := sentiment.OpenSession()
  defer session.Close()
  result, _ := sentiment.Evaluate(
    []string{"This is the best movie I have ever seen, simply love it!"},
    session)
  println(result[0])
}

Science

arch

We scan through the text by byte in both directions, and the length is constrained to 180 bytes. The training is written in Python and is based on Keras and Tensorflow. The achieved accuracy on 20% validation is 87%. The train dataset was 1.5 million tweets. The default parameters were used. The model easily overfits, so only the first 5 epochs were used.

validation

Update the model in the Go inference application by executing

go-bindata  -nomemcopy -nometadata -pkg assets -o assets/bindata.go  model.pb english.json

Contributins

...are welcome! See CONTRIBUTING.md and CODE_OF_CONDUCT.md.

License

MIT, see LICENSE.

bidisentiment's People

Contributors

vmarkovtsev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.