All Projects → arjunmenon → smalltext

arjunmenon / smalltext

Licence: MIT License
Classify short texts with neural network.

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to smalltext

rgbd person tracking
R-GBD Person Tracking is a ROS framework for detecting and tracking people from a mobile robot.
Stars: ✭ 46 (+206.67%)
Mutual labels:  classifier
Water-classifier-fastai
Deploy your Flask web app classifier on Heroku which is written using fastai library.
Stars: ✭ 37 (+146.67%)
Mutual labels:  classifier
naive-bayes-classifier
Implementing Naive Bayes Classification algorithm into PHP to classify given text as ham or spam. This application uses MySql as database.
Stars: ✭ 21 (+40%)
Mutual labels:  classifier
tbcnn
Efficient tree-based convolutional neural networks in TensorFlow
Stars: ✭ 121 (+706.67%)
Mutual labels:  classifier
tensorflow-image-classifier
Easily train an image classifier and then use it to label/tag other images
Stars: ✭ 29 (+93.33%)
Mutual labels:  classifier
ML4K-AI-Extension
Use machine learning in AppInventor, with easy training using text, images, or numbers through the Machine Learning for Kids website.
Stars: ✭ 18 (+20%)
Mutual labels:  classifier
sentiment-analysis-using-python
Large Data Analysis Course Project
Stars: ✭ 23 (+53.33%)
Mutual labels:  classifier
simple-image-classifier
Simple image classifier microservice using tensorflow and sanic
Stars: ✭ 22 (+46.67%)
Mutual labels:  classifier
NN-scratch
Coding up a Neural Network Classifier from Scratch
Stars: ✭ 78 (+420%)
Mutual labels:  classifier
dl-relu
Deep Learning using Rectified Linear Units (ReLU)
Stars: ✭ 20 (+33.33%)
Mutual labels:  classifier
Emotion and Polarity SO
An emotion classifier of text containing technical content from the SE domain
Stars: ✭ 74 (+393.33%)
Mutual labels:  classifier
chatto
Chatto is a minimal chatbot framework in Go.
Stars: ✭ 98 (+553.33%)
Mutual labels:  classifier
Bag-of-Visual-Words
🎒 Bag of Visual words (BoW) approach for object classification and detection in images together with SIFT feature extractor and SVM classifier.
Stars: ✭ 39 (+160%)
Mutual labels:  classifier
scoruby
Ruby Scoring API for PMML
Stars: ✭ 69 (+360%)
Mutual labels:  rubyml
pca
Principal component analysis (PCA) in Ruby
Stars: ✭ 25 (+66.67%)
Mutual labels:  rubyml
VALIS
Vote ALlocating Immune System, an immune-inspired classification algorithm
Stars: ✭ 21 (+40%)
Mutual labels:  classifier
Deep-Learning-Experiments-implemented-using-Google-Colab
Colab Compatible FastAI notebooks for NLP and Computer Vision Datasets
Stars: ✭ 16 (+6.67%)
Mutual labels:  classifier
text2class
Multi-class text categorization using state-of-the-art pre-trained contextualized language models, e.g. BERT
Stars: ✭ 15 (+0%)
Mutual labels:  classifier
labelReader
Programmatically find and read labels using Machine Learning
Stars: ✭ 44 (+193.33%)
Mutual labels:  classifier
pghumor
Is This a Joke? Humor Detection in Spanish Tweets
Stars: ✭ 48 (+220%)
Mutual labels:  classifier

Smalltext

Classify short texts with neural network.

This gem is specifically created to classify small sentence/datasets using a supervised training algorithm. You can use this in place of Naive Bayes.

Installation

Requires Ruby >= 2.3.3

Add this line to your application's Gemfile:

gem 'smalltext'

And then execute:

$ bundle

Or install it yourself as:

$ gem install smalltext

Dependencies

Gem depends on Numo/NArray, Porter2Stemmer, Tokenizer, Croupier

Gem dependencies should be automatically installed.

Usage

Classification is easy to get started.

require 'smalltext'

s = Smalltext::Classifier.new

# Add your sentence using the `add_item` method
# Classifier#add_item(category, sentence)

s.add_item("schedule_list", "What time is my next session?")
s.add_item("schedule_list", "When is my next session?")
s.add_item("schedule_list", "What time is my next meeting?")
s.add_item("schedule_list", "Can you please show me my schedule?")
s.add_item("schedule_list", "Show me my schedule.")

s.add_item("greetings", "Hi")
s.add_item("greetings", "How are you doing?")
s.add_item("greetings", "have a nice day")
s.add_item("greetings", "good morning.")
s.add_item("greetings", "Whats up")
s.add_item("greetings", "Yo")

s.add_item("where_is", "Where is narkel bagan")
s.add_item("where_is", "show me the way to sasta sundar")
s.add_item("where_is", "where is the staircase")
s.add_item("where_is", "give me the direction to the parking lot")

s.add_item("weather", "Whats the weather")
s.add_item("weather", "Weather in Noida")
s.add_item("weather", "Is it raining")
s.add_item("weather", "Will it be hot tomorrow in Mumbai")
s.add_item("weather", "What is the maximum temperature today")

s.add_item("finance", "How many dollars is 17 euros?")
s.add_item("finance", "How much is 100 ruppees in US dollars")
s.add_item("finance", "How much is Starbucks stock?")
s.add_item("finance", "Tell me bitcoin exchange rate")
s.add_item("finance", "What is the value of ruppee")
s.add_item("finance", "Share price of Microsoft")

# Train a model using the Classifier#train method

s.train

# Test your trained model using the Classifier#classify(sentence) method

s.classify("give me the direction to moon")

# sentence: give me the direction to moon
# classification: [["where_is", 1.0]]

# => [["where_is", 1.0]]

You can also save your model. Use the Classifier#save_model(file_name)

s.save_model('intents.model')

To load a saved model use the Classifier#load_model(file_name)

s.load_model('intents.model')

s.classify("when is the next meeting")
# sentence: when is the next meeting
# classification: [["schedule_list", 0.9999189960209529]]

# => [["schedule_list", 0.9999189960209529]]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/arjunmenon/smalltext. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Smalltext project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Credits

This gem is a Ruby port to the Medium article describing text classification in Python.

Roadmap

Goal of this gem is be an efficient tool for short texts classifications, where dataset is a constraint.

  • Implement word vectors. When dataset is sparse, we should leverage word vectors to map in categorizing unseen words.

  • More algorithm options Apart from neural networks, one can also switch and compare with different algorithms which mostly suits their needs.

Todo

  • Write Tests
  • Add support for batch training
  • Add SVD
  • Add support for word vectors. Need to try this method.
  • Add more classification algorithms.
  • Add benchmarking
  • Create model for known text datasets like Reuters, etc.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].