'Detect context with python

If I have the following strings:

str1 = 'Steel toe boots are required'
str2 = 'Steel toe considerations: required'
str3 = 'Steel toe optional'
str4 = 'Steel toe precoutions: just be careful'
str5 = 'Steel toe are optional'
str6 = 'Steel toe up to you'
str7 = 'Steel toe mandatory'

And any combination of different wording saying the same things differently, ie whether steel toe boots are required, and I wanted to reduce each of these strings into a bolean of True or False for a database variable. What is the best way to do this/ best library for achieving the most accurate result.

I have tried just searching the text for Steel toe and Steel toe required but thats only so accurate as the amount of information I am receiving is a lot so possible wordings can be very different.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source