This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import processing.serial.*; | |
| import ddf.minim.signals.*; // Minim sound library | |
| import ddf.minim.*; | |
| import ddf.minim.analysis.*; | |
| import ddf.minim.effects.*; | |
| int prevent = 0; // Double ring prevention | |
| Serial myPort; // The serial port | |
| Minim minim; | |
| AudioPlayer a; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <HashMap.h> | |
| int mini = 0; | |
| int maxi = 16; | |
| const byte HASH_SIZE = 16; | |
| HashType<int,int> hashRawArray[HASH_SIZE]; | |
| HashMap<int,int> hashMap = HashMap<int,int>( hashRawArray , HASH_SIZE ); | |
| void setup(){ | |
| Serial.print("reset"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'lda-ruby' | |
| corpus = Lda::Corpus.new | |
| corpus.add_document(Lda::TextDocument.new(corpus, "a lion is a wild feline animal", [])) | |
| corpus.add_document(Lda::TextDocument.new(corpus, "a dog is a friendly animal", [])) | |
| corpus.add_document(Lda::TextDocument.new(corpus, "a cat is a feline animal", [])) | |
| lda = Lda::Lda.new(corpus) | |
| lda.verbose = false | |
| lda.num_topics = (2) | |
| lda.em('random') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'classifier' | |
| require 'stemmer' | |
| classifier_lsi = Classifier::LSI.new | |
| classifier_lsi.add_item "a lion is a wild feline animal", :cat | |
| classifier_lsi.add_item "a dog is a friendly animal", :dog | |
| classifier_lsi.classify "a cat is a feline animal" | |
| # Results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'clusterer' | |
| include Clusterer | |
| @idf = InverseDocumentFrequency.new() | |
| a = Document.new("a lion is a wild feline animal", :idf => @idf).normalize!(@idf) | |
| b = Document.new("a dog is a friendly animal", :idf => @idf).normalize!(@idf) | |
| c = Document.new("a cat is a feline animal", :idf => @idf).normalize!(@idf) | |
| clus = Algorithms.bisecting_kmeans([a,b,c], 2, :maximum_iterations => 5) | |
| # Results |