2023-10-13 00:04:20 +00:00
|
|
|
namespace :dataset do
|
2023-10-13 00:02:10 +00:00
|
|
|
desc "TODO"
|
|
|
|
task ingest: :environment do
|
|
|
|
ingest_data
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def ingest_data
|
|
|
|
if PartOfSpeech.count > 0
|
|
|
|
puts "Data already exists in table! Aborting."
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
parts_of_speech = JSON.parse(File.read('db/dataset_en/toki-partsofspeech.json'))
|
|
|
|
|
|
|
|
parts_of_speech.each do |pos|
|
|
|
|
PartOfSpeech.create(pos: pos['pos'], definition: pos['definition'])
|
|
|
|
end
|
|
|
|
puts "Ingest complete."
|
|
|
|
end
|