First we need to import metaknowledge like we saw in lesson 1.
In [1]:
import metaknowledge as mk
we only need metaknowledge for now so no need to import everything
The files from the Web of Science (WOS) can be loaded into a RecordCollections by creating a RecordCollection
with the path to the files given to it as a string.
In [2]:
RC = mk.RecordCollection("savedrecs.txt")
repr(RC)
Out[2]:
You can also read a whole directory, in this case it is reading the current working directory
In [3]:
RC = mk.RecordCollection(".")
repr(RC)
Out[3]:
metaknowledge can detect if a file is a valid WOS file or not and will read the entire directory and load only those that have the right header. You can also tell it to only read a certain type of file, by using the extension argument.
In [4]:
RC = mk.RecordCollection(".", extension = "txt")
repr(RC)
Out[4]:
Now you have a RecordCollection
composed of all the WOS records in the selected file(s).
In [5]:
print("RC is a " + str(RC))
You might have noticed I used two different ways to display the RecordCollection
. repr(RC)
will give you where metaknowledge thinks the collection came from. While str(RC)
will give you a nice string containing the number of Records
.