How to use unigram and bigram as an feature on SVM or logistic regression [closed]

How to use unigram and bigram as an feature to build an Natural Language Inference model on SVM or logistic regression?on my dataset i have premise, hypotesis and label column. I'm planning to use the unigram and bigram of the premis or hipotesis or both as one of the features on my training. for example :

 premise                                      |hipotesis                         |hypothesis bigram
===============================================================================================
I am planning to use the unigram and bigram   |I am planning to use the unigram  |[(i, am), (am, planning), (planning, to), (to, use), (use, the), (the, unigram)]


the hypothesis bigram is a list of bigram(word), so i cant use it as input to my svm or logistic. can i convert the hypothesis bigram into vector?

• Please explain more on the "How". What is your expectation and what is your currently achieved status/code? You might get a very simple answer e.g. an SVM classification code etc., which will not serve your purpose. – 10xAI Jul 2 at 4:21
• for example can i turn it into vector so i can use it to my svm or logistic regression? – thenoirlatte Jul 2 at 5:15

Machine learning libraries typically have functions that do that. For instance, in scikit-learn, you can use CountVectorizer to do the job. The fit method has an ngram_range argument that controls the length of n-grams that are considered in the feature vectors.