How do I use sklearn CountVectorizer with both 'word' and 'char' analyzer? - python

后端 未结 2 1094
小蘑菇
小蘑菇 2020-12-16 01:19

How do I use sklearn CountVectorizer with both \'word\' and \'char\' analyzer? http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectoriz

2条回答
  •  眼角桃花
    2020-12-16 01:51

    You can combine arbitrary feature extraction steps with the FeatureUnion estimator: http://scikit-learn.org/dev/modules/pipeline.html#featureunion-combining-feature-extractors

    In this case this is probably less efficient than larsmans solution, but might be easier to use.

提交回复
热议问题