开发者

Setting Worker Qualifications with RTurk and Turkee

开发者 https://www.devze.com 2023-03-28 05:33 出处:网络
I\'m using the Turkee (https://github.com/aantix/turkee) gem with my Rails app to interface with Mechanical Turk. I\'m creating a HIT like so:

I'm using the Turkee (https://github.com/aantix/turkee) gem with my Rails app to interface with Mechanical Turk. I'm creating a HIT like so:

h = RTurk::Hit.create(:title => name || DEFAULT_TITLE) do |hit|
  hit.assignments = size
  hit.description = DEFAULT_DESCRIPTION
  hit.reward      = DEFAULT_REWARD
  hit.lifetime    = DEFAULT_DURATION
  hit.question(survey_url, :frame_height => 1000)

end

Turkee::TurkeeTask.create(:sandbox             => RTurk.sandbox?,
                          :hit_title           => (name || DEFAULT_TITLE),
                          :hit_description     => DEFAULT_DESCRIPTION,
                          :hit_reward          => DEFA开发者_如何学CULT_REWARD.to_f,
                          :hit_num_assignments => size.to_i,
                          :hit_lifetime        => (DEFAULT_DURATION.seconds/1.day).to_i,
                          :form_url            => survey_url,
                          :hit_url             => h.url,
                          :hit_id              => h.id,
                          :task_type           => '',
                          :batch_id            => id,
                          :complete            => false)

Everything works fine, but I want to add a qualification to make sure that anyone that does the task is from the United States. I've looked through the docs and I know this is possible, but I'm having trouble figuring out exactly how to implement it. Does anyone have any suggestions?

Thanks in advance :)


You will want to add a country qualification. You can change your hit creation code like so (see the last line)

h = RTurk::Hit.create(:title => name || DEFAULT_TITLE) do |hit|
  hit.assignments = size
  hit.description = DEFAULT_DESCRIPTION
  hit.reward      = DEFAULT_REWARD
  hit.lifetime    = DEFAULT_DURATION
  hit.question(survey_url, :frame_height => 1000)
  hit.qualifications.country :eql => ['US']
end
0

精彩评论

暂无评论...
验证码 换一张
取 消