22 lines
432 B
Ruby
22 lines
432 B
Ruby
namespace :dataset do
|
|
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
|