Ruby code for Feature Extraction