Search code examples
pythonnlphuggingface

Determine category of sentence


I have a list of Books with Title and Organization. I would like to get the category of each book. Category list is predefined and choose one of them.

Books Title 1: Agriculturalpolicy and the decisions ofagriculturalproducers as to income and investment Organization 1: Western Agricultural Economics Association

Categories: Agriculture, Engineering, Healthcare

Can I find the category of the Book using Python?

I tried using Transformers from HuggingFace but I don't have predefined data to train or evaluate.

I am not sure whether there is an existing solution or not.


Solution

  • If the categories are well distinct, zero-shot classification can be used without training or specifying keywords.

    Check out this introductory page.