With Wolfram Language you may use TextCases
or TextContents
from the Text Analysis guide. These are both experimental functions so may change a bit before they are finalised in a future version. Both have the TargetDevice
option so you can run them on one or more GPUs if you have them.
Reference the Text Content Types guide for the list of entities these functions have been trained on.
I think TextContents
is an optimised call to TextCases
for multiple cases so I will only use TextContents
below.
Use TextContents
to locate all trained entities in your sentences.
res1 = TextContents["The temperature today is 35°C.", TargetDevice -> "GPU"]
res2 = TextContents["Store risperidone tablet at 20°C.", TargetDevice -> "GPU"]
TextContents
returns a Dataset
object that can be Query
'ed for specific cases.
For example for your "DrugTemperature"
res2[ContainsAll[{"Chemical", "Quantity"}], "Type"]
True
and the quantity units
res2[
SelectFirst[#["Type"] == "Quantity" &],
"String" /* SemanticInterpretation /* QuantityUnit]
"DegreesCelsius"
An Entity
of type "Chemical"
has a wealth of properties so additional information can be obtained if needed. For example,
res2[
SelectFirst[#["Type"] == "Chemical" &],
"String" /* Interpreter["Chemical"] /* (#["MoleculePlot"] &)]
Hope this helps.