How to train a Text Based data for a Machine Learning problem? I am working on a project for displaying products to customer by context, based on a search query. For example, I don't want customers to have to enter a specific product name, instead searching based on functionality (e.g., "walls do not heat much" would return product names such as "Whirlpool NEO IC355 ROY 3S 340 L Double Door Refrigerator")  
I have a training set comprised of the functionality associated products. I am planning to use Logistic Regression to train a model on these data. How do I process this data in Python or extract features to feed into logistic regression? I have heard of "Bag of words model", but not sure how to use this, or is it even applicable here?


I know there are plenty of NLTK libraries available. But, I want to implement it from the scratch or using minimum external libraries possible. 

Please help or are there any resources to refer to?
Your problem looks more like a ranking problem than a classification problem to me. Have you tried a more naive method, like a 1-NN "classifier" with unigram text representation, Tf-Idf term weighting and a cosine similarity metric? It's far from the state of the art but it tends to give rather good results in retrieval and recommendation tasks.