I'm trying to read a dataset and parse that into the data I need. The file will consist of lines of strings like this:
id: 1234567 synset: test,exam
I want to then obtain the id
number and the synset
word. So in this case, I want 1234567
and test,exam
Here's what I've come up with, but I'm sure there are better ways.
File.open(synsets_file, "r") do |f|
f.each_line do |line|
id = line.split[1].to_i
nouns = line.split[3]
#do things with id and nouns
end
end