from shogun.Features import StringCharFeatures, RAWBYTE

# load features from file
f=StringCharFeatures(RAWBYTE)
f.load_from_directory(".")

#and output several stats
print "max string length", f.get_max_vector_length()
print "number of strings", f.get_num_vectors()
print "length of first string", f.get_vector_length(0)
print "str[0,0:3]", f.get_feature(0,0), f.get_feature(0,1), f.get_feature(0,2)
print "len(str[0])", f.get_vector_length(0)
print "str[0]", f.get_feature_vector(0)


@@ -75,12 +75,17 @@
 rom 
-file
+directory
 %0Af=S
@@ -484,8 +484,194 @@
 tor(0)%0A%0A
+#or load features from file (one string per line)%0Af.load('features_string_char_modular.py')%0Aprint f.get_features()%0A%0A#or load fasta file%0A#f.load_fasta('fasta.fa')%0A#print f.get_features()%0A

document how to load strings from file or fasta file