Setting Worker Qualifications with RTurk and Turkee
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
精彩评论