You will have to keep maintain a data base(storage) of Books
, Food
and Medical Supplies
to do something like this. Then when you can check your String with that three and decide.
As an example you can simulate simple case. Let's say you are going to keep three Maps
Map<String,String> store=new HashMap<String,String>();
store.put("GameOfThrowns","Book");
store.put("Rice","Food");
The you can simply get value for your String
match with key of this Map
.
FYI:
You can't reach your goal since it is more related to Artificial Intelligence you have to use Neural Network and that is still belongs to laboratory level, But this is just a try.