Created
October 30, 2009 23:21
-
-
Save newtonapple/222815 to your computer and use it in GitHub Desktop.
RTurk Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RTurk.setup(AWSAccessKeyId, AWSAccessKey, :sandbox => true) | |
hit = RTurk::Hit.create(:title => "New Upload 3 Documents") do |hit| | |
hit.assignments = 500 | |
hit.description = "no copytrighted materials!" | |
hit.question("http://localhost:3000/mturk") | |
hit.reward = 0.10 | |
hit.qualifications.add :approval_rate, { :gt => 85 } | |
end | |
hits = [] | |
2.times do |i| | |
hits << RTurk::Hit.create(:title => "Test ##{i} Upload 3 Documents") do |hit| | |
hit.assignments = 1 | |
hit.hit_type_id = 'EGMZR9ZNWR1C5E8BRX8Z' | |
hit.description = "no copytrighted materials!" | |
hit.question("http://localhost:3000/mturk") | |
hit.lifetime = 172800 # two days | |
hit.reward = 0.10 | |
hit.qualifications.add :approval_rate, { :gt => 85 } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rturk' | |
props = {:Title=>"Tell me if this picture is safe for general audiences", | |
:MaxAssignments=>1, :LifetimeInSeconds=>3600, | |
:Reward=>{:Amount=>0.05, :CurrencyCode=>"USD"}, | |
:Keywords=>"twitter, blogging, writing, english", | |
:Description=>"I need to know if this picture is vulgar or adult only", | |
:RequesterAnnotation=>"Example1", | |
:AssignmentDurationInSeconds=>3600, :AutoApprovalDelayInSeconds=>3600, | |
:QualificationRequirement=>[{ | |
# Approval rate of greater than 90% | |
:QualificationTypeId=>"000000000000000000L0", | |
:IntegerValue=>90, | |
:Comparator=>"GreaterThan", | |
:RequiredToPreview=>"false" | |
}] | |
} | |
@turk = RTurk::Requester.new(AWSAccessKeyId, AWSAccessKey, :sandbox => true) | |
page = RTurk::ExternalQuestionBuilder.build( | |
"http://s3.amazonaws.com/squarepush.com/turk/picturerate.html", :picture_url => 'example.jpg') | |
# Turkers will be directed to http://s3.amazonaws.com/squarepush.com/turk/picturerate.html?picture_url=example.jpg&AssignmentId=abcd12345 | |
@turk.create_hit(props, page) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment