Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Commented StreamingStringFeatures example better.
  • Loading branch information
frx committed Aug 26, 2011
1 parent 65a020c commit a6bf023
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/undocumented/libshogun/streaming_stringfeatures.cpp
@@ -1,3 +1,5 @@
// This example simply demonstrates the use/working of StreamingStringFeatures

#include <shogun/io/StreamingAsciiFile.h>
#include <shogun/features/StreamingStringFeatures.h>

Expand All @@ -18,11 +20,15 @@ int main(int argc, char **argv)
{
init_shogun_with_defaults();

// Create a StreamingAsciiFile from our input file
CStreamingAsciiFile* file = new CStreamingAsciiFile("../data/fm_train_dna.dat");

// This file contains unlabelled data, so the second arg is `false'.
CStreamingStringFeatures<char>* feat = new CStreamingStringFeatures<char>(file, false, 1024);
// Alphabet to use is DNA
feat->use_alphabet(DNA);

// Loop over all examples and simply display each example
feat->start_parser();
while (feat->get_next_example())
{
Expand All @@ -32,12 +38,12 @@ int main(int argc, char **argv)
}
feat->end_parser();

// Get the alphabet and display the histogram
CAlphabet* alpha = feat->get_alphabet();

printf("\nThe histogram is:\n");
alpha->print_histogram();

SG_UNREF(alpha);

SG_UNREF(feat);
SG_UNREF(file);

Expand Down

0 comments on commit a6bf023

Please sign in to comment.