Finding new chemical relationships

Now let's extract a new relationship from a previously unseen sentence. We will save to a different file so we can see the new clusters afterwards. We hope that the sentence will be similar enough to a previously seen sentence in order for us to extract the new relationship.

snowball.save_file_name = 'curie_new'
test_sentence = Sentence('BiFeO3 is highly ferromagnetic with a curie temperature of 1103 K and that is extremely interesting')
rels = snowball.extract(test_sentence)
print("Found relationship:", rels)
>>>Found relationship: [<(1103,value_1,9,10), (K,units_1,10,11), (curie temperature,specifier_1,6,8), (BiFeO3,name_1,0,1)>]

As we can see, we found the right entities. Lets see how confident we are in this relation

The confidence score has been determined by measuring the level of textual similarity with the examples found during training.

>>> 1.0

Of course, this worked because our new sentence was (purposefully) similar to one that already existed in the training set. In order for this to work more gnereally you will need to train on a lot more than 7 examples.