当前位置: 首页>>代码示例>>Python>>正文


Python question.Overview类代码示例

本文整理汇总了Python中boto.mturk.question.Overview的典型用法代码示例。如果您正苦于以下问题:Python Overview类的具体用法?Python Overview怎么用?Python Overview使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Overview类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_question_form_HIT

    def make_question_form_HIT(self,audio_clip_urls,hit_title,question_title,description,keywords,
                               duration=DEFAULT_DURATION,reward=DEFAULT_REWARD):
        overview = Overview()        
        overview.append_field("Title",hit_title)
        #overview.append(FormattedContent('<a target = "_blank" href="url">hyperlink</a>'))
        question_form = QuestionForm()
        question_form.append(overview)
        for ac in audio_clip_urls:
            audio_html = self.transcription_question.replace(self.audio_url_tag,ac)
            qc = QuestionContent()
            qc.append_field("Title",question_title)            
            qc.append(FormattedContent(audio_html))
            fta = FreeTextAnswer()
            q = Question(identifier="transcription",
                         content=qc,
                         answer_spec=AnswerSpecification(fta))
            question_form.append(q)
        try:
            response = self.conn.create_hit(questions=question_form,
                             max_assignments=1,
                             title=hit_title,
                             description=description,
                             keywords=keywords,
                             duration=duration,
                             reward=reward)
        except MTurkRequestError as e:
            if e.reason != "OK":
                raise 

        return question_form, response
开发者ID:tturpen,项目名称:CrowdsourcedAutomaticSpeechRecognition,代码行数:30,代码来源:MechanicalTurk.py

示例2: generate_hit

  def generate_hit(self, num_assignments, hit_duration, hit_reward):
    """
    Purpose: Generate and publish the HIT
    Parameters: num_assignments is the number of avaliable assignments for hit, 
                hit_duration is the duration of the hit in seconds (60*5 for 5 minutes),
                hit_reward is the reward given per hit in dollars (0.05 is 5 cents)
    """
    # CONNECT TO MTURK

    mtc = MTurkConnection(aws_access_key_id = self.access_id,
                      aws_secret_access_key = self.secret_key,
                      host = self.host)

    # BUILD OVERVIEW 
     
    overview = Overview()

    overview.append_field('Title', 'The following one or more sentences constitute an incomplete story.')
    story = ""
    for sentence in self.story_sentences:
      story += sentence + " "
    overview.append(FormattedContent(story))
  
    # BUILD QUESTION 1: Copy the first sentence of the story 
     
    qc1 = QuestionContent()
    qc1.append_field('Title','Copy verbatim the first sentence of the provided incomplete story. Please keep all capitalization and punctuation as given. Your sumbission will automatically be rejected if any character is incorrect.')
    fta1 = FreeTextAnswer()
    q1 = Question(identifier='verify_sentence', content = qc1, answer_spec = AnswerSpecification(fta1), is_required = True)

    # BUILD QUESTION 2: Vote on the best sentence to continue the story
    
    sentence_options = []
    for i, sentence in enumerate (self.vote_sentences):
      selection = (sentence, str(i))
      sentence_options.append(selection)
    qc2 = QuestionContent()
    qc2.append_field('Title','Choose the best sentence to continue the story.')
    fta2 = SelectionAnswer(min=1, max=1,style='radiobutton',
                      selections=sentence_options,
                      type='text',
                      other=False)
    q2 = Question(identifier='vote_sentence', content = qc2, answer_spec = AnswerSpecification(fta2), is_required = True)

    # BUILD THE QUESTION FORM 
     
    question_form = QuestionForm()
    question_form.append(overview)
    question_form.append(q1)
    question_form.append(q2)
     
    # CREATE THE HIT 
     
    mtc.create_hit(questions = question_form,
                   max_assignments = num_assignments,
                   title = self.title,
                   description = self.description,
                   keywords = self.keywords,
                   duration = hit_duration,
                   reward = hit_reward)
开发者ID:Kmystic,项目名称:Turkey-Stories,代码行数:60,代码来源:mturk_vote_sentence.py

示例3: createHits

def createHits(question, answers, params):
	if SANDBOX:
		mturk_url = 'mechanicalturk.sandbox.amazonaws.com'
		preview_url = 'https://workersandbox.mturk.com/mturk/preview?groupId='
	else:
		mturk_url = 'mechanicalturk.amazonaws.com'
		preview_url = 'https://mturk.com/mturk/preview?groupId='

	#Create Hit Form Structure	
	overview  = Overview()
	overview.append_field('Title', 'We want to know the crowds opinion!')
	overview.append(FormattedContent('<a href="http://programthecrowd.com/">Visit us here</a>'))
	questionContent = QuestionContent()
	questionContent.append_field('Title', question);
	answerChoices = SelectionAnswer(min=1, max=1, style='checkbox', selections=answers, type='text', other=False)
	q = Question(identifier='Help', content=questionContent, answer_spec=AnswerSpecification(answerChoices), is_required=True)
	questionForm = QuestionForm();
	questionForm.append(overview)
	questionForm.append(q)
	hitIdList = []
	global conn
	# key = params['aws_access_key']
	# secret = params['aws_secret_key']
	conn = MTurkConnection(aws_access_key_id='AKIAJBTEJI2RGTJH7OBA', aws_secret_access_key='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', host=mturk_url)
	
	#For Loop to create and post hits
	for i in range(0, NUMBER_OF_HITS):
		create_hit_rs = conn.create_hit(questions=questionForm, lifetime=LIFETIME, max_assignments=NUMBER_OF_ASSIGNMENTS, title=TITLE, keywords=KEYWORDS, reward=REWARD, duration=DURATION, approval_delay=APPROVAL_DELAY, annotation=DESCRIPTION)
		#print(preview_url + create_hit_rs[0].HITTypeId)
		#print("HIT ID: " + create_hit_rs[0].HITId)
		hitIdList.append(create_hit_rs[0].HITId);

	return hitIdList
开发者ID:archanaiyer,项目名称:CrowdSQL,代码行数:33,代码来源:mturkconnector.py

示例4: createHIT2

def createHIT2(possibleAnswers,sentence, context):
	title = 'Pick the best translation!'
	description = ('Pick the best translation!')
	keywords = 'translate, language'

	ratingsDic = {}
	ratings = []
	i = 0
	for answer in possibleAnswers:
		ratings.append((answer,i))
		ratingsDic[i] = answer
		i = i + 1
	 
	#---------------  BUILD OVERVIEW -------------------
	 
	overview = Overview()
	overview.append_field('Title', title)
	overview.append(FormattedContent('<p>' + context + '</p>' + '<p><b>' + sentence + '</b></p>'))
	 
	 
	#---------------  BUILD QUESTION 2 -------------------
	 
	qc1 = QuestionContent()
	qc1.append_field('Title','Please pick the best translation for the bolded sentence above.')
	 
	fta1 = SelectionAnswer(min=1, max=1,style='radiobutton',
                      selections=ratings,
                      type='text',
                      other=False)
 
	q1 = Question(identifier='pick',
              content=qc1,
              answer_spec=AnswerSpecification(fta1),
              is_required=True)
	 
	#--------------- BUILD THE QUESTION FORM -------------------
	 
	question_form = QuestionForm()
	question_form.append(overview)
	question_form.append(q1)

	#--------------- CREATE QUALIFICATION REQUIREMENT -------------------
	qual_req = Requirement(qualification_type_id=QUALIFICATION_ID,
					comparator="Exists")
	
	quals = Qualifications(requirements=[qual_req]) 
	#--------------- CREATE THE HIT -------------------
	 
	resultSet = mtc.create_hit(questions=question_form,
				   max_assignments=HIT2_MAX_ASSIGN,
				   title=title,
				   description=description,
				   keywords=keywords,
				   duration = 60*5,
				   reward=0.50,
				   qualifications=quals)

	
	return (resultSet[0].HITId,ratingsDic)
开发者ID:gpaulu,项目名称:mTurkTranslation,代码行数:59,代码来源:mturk.py

示例5: create_question_form

def create_question_form(title, description, keywords):
    """ 
    Create an overview for an MTurk HIT 
    """
    overview = Overview()
    overview.append_field('Title', title)
    question_form = QuestionForm() 
    question_form.append(overview)
    return question_form
开发者ID:pmn,项目名称:docsift-old,代码行数:9,代码来源:mturk.py

示例6: launchHIT

def launchHIT(mtc, drawing_id, payment, title):

  #title = 'Add a single line to this drawing: easy!'
  description = ('We need your help to make the best art possible!')
  keywords = 'drawing, web, art, research, paint, creative, easy, simple, fast'
  choices = [('done','done')]
  drawing_id = "http://2.distributeddrawing.appspot.com/" + drawing_id
  #------------------- Overview ---------------------
  overview_content = ("<p>Your task is to follow the link and draw a single line stroke in the box shown.  It's Easy! Just left-click in the box and drag your cursor around to create your stroke (just like in MS Paint).</p>"
                      '<p>BUT...try to add something to the picture.  If the square is blank, start off the image with something cool.  If there is already an image going, add something that makes it better.</p>'
                      '<p>Help us make some great drawings!</p>'
                      '<ul>'
                      '<li><b>Get started: </b>  <a href=" ' + drawing_id + '" target="_blank">Click here</a> </li>'
                      '</ul>')


  overview = Overview()
  overview.append_field('Title', 'Draw a line in the box to complete the task.')
  overview.append(FormattedContent( overview_content))

  #------------------- Question test ---------------------

  #urlContent = '<a target="_blank" href="http://www.toforge.com"> Canvas </a>'

  qc1 = QuestionContent()
  qc1.append_field('Title','Click on the submit button once you have finished the task.')
  qc1.append(FormattedContent('The payment will not be authorized if you have not completed the task.  Also, you can only complete this task once (all subsequent submissions will be rejected).'))

  answers = SelectionAnswer(min=1, max=1,style='dropdown',
                        selections=choices,
                        type='text',
                        other=False)

  #question1 = ExternalQuestion(external_url='http://distributeddrawing.appspot.com/',frame_height=400)

  q1 = Question(identifier='task',
                content=qc1,
                answer_spec=AnswerSpecification(answers),
                is_required=True)

  #------------------- Question form creation ---------------------

  questionForm = QuestionForm()
  questionForm.append(overview)
  questionForm.append(q1)

  #------------------- HIT creation ---------------------

  return mtc.create_hit(question=questionForm,
                 max_assignments=1,
                 lifetime=datetime.timedelta(days=1),
                 title=title,
                 description=description,
                 keywords=keywords,
                 duration = 60*5,
                 reward=payment,
                 response_groups=['Minimal'])
开发者ID:tvkwoodlands,项目名称:ddos,代码行数:57,代码来源:boto_wrapper.py

示例7: create_question_form

def create_question_form(mtc, uuid, url):
    title = 'Bovid Labs HIT v2017.07.31 - %(uuid)s' % vars()
    description = ('Help us extract a polygon from this research image.')
    keywords = 'image, extraction, gimp'

    overview = Overview()
    overview.append_field('Title', 'Instructions')

    # Overview text is where we'll put the details about the HIT
    # img previews the tooth image
    # a allows user to download the image and save as

    text = """
      <p>Your job is to extract the outline of the tooth in the following image.</p>
      
      <p>You need to install the current version of Gimp on your computer. It can
      be downloaded from
      <a href="https://www.gimp.org/downloads/">https://www.gimp.org/downloads/</a></p>

      <p>We have prepared a video at <a href="https://www.youtube.com/watch?v=nzxZqIp3XZY">
      https://www.youtube.com/watch?v=nzxZqIp3XZY</a> showing how to do the task. Once you have extracted
      the outline, you will upload the final result (file) to this HIT.
      </p>
      
      <p>For the HIT to be complete, you must upload a the black polygon against
      a white background. The image size must match the original image size.</p>

      <p>Image download URL: <br/>
         <a href="%(url)s">
            <img src="%(url)s" alt="direct link to image %(uuid)s"/>
         </a>
      </p>
      """ % vars()

    overview.append(FormattedContent(text))

    qc1 = QuestionContent()
    qc1.append_field('Title', 'File Upload Question')

    fu1 = FileUploadAnswer(1024, 1024 * 1024 * 10)

    q1 = Question(identifier="fileupload",
                  content=qc1,
                  answer_spec=AnswerSpecification(fu1))

    question_form = QuestionForm()
    question_form.append(overview)
    question_form.append(q1)

    # TODO: We want to separate creation of form from uploading the hit
    # need to factor out arguments....
    # duration and lifetime are in seconds.
    # we will give 30 minutes duration (30 * 60) to complete the task
    # we will keep these hits around for 14 days (14 * 24 * 60 * 60)
    print(question_form.get_as_xml())
    mtc.create_hit(questions=question_form, max_assignments=3, title=title, description=description, keywords=keywords,
                   duration=60 * 30, lifetime=3 * 24 * 60 * 60, reward=0.10)
开发者ID:gkthiruvathukal,项目名称:mturk-imgupload-boto-python,代码行数:57,代码来源:mturk_img_upload.py

示例8: submit_extract_keywords_hit

def submit_extract_keywords_hit(note):
    """Create a Mechanical Turk HIT that asks a worker to
    choose keywords and definitions from the given note."""

    try:
        MTURK_HOST = os.environ['MTURK_HOST']
    except:
        logger.warn('Could not find Mechanical Turk secrets, not running submit_extract_keywords_hit')
        return

    connection = MTurkConnection(settings.AWS_ACCESS_KEY_ID, settings.AWS_SECRET_ACCESS_KEY,
                                 host=MTURK_HOST)

    if note.course.school:
        title = KEYWORDS_HIT_TITLE_TEMPLATE.format(course=note.course.name, school=note.course.school.name)
    else:
        title = KEYWORDS_HIT_TITLE_TEMPLATE.format(course=note.course.name, school=note.course.department.school.name)

    overview = Overview()
    overview.append(FormattedContent(KEYWORDS_HIT_OVERVIEW_TEMPLATE.format(domain=Site.objects.get_current(),
                                                                  link=note.get_absolute_url())))

    keyword_fta = FreeTextAnswer()
    keyword_fta.num_lines = 1

    definition_fta = FreeTextAnswer()
    definition_fta.num_lines = 3

    question_form = QuestionForm()
    question_form.append(overview)

    for i in range(min(len(KEYWORDS_HIT_KEYWORD_FIELDS), len(KEYWORDS_HIT_DEFINITION_FIELDS))):
        keyword_content = QuestionContent()
        keyword_content.append_field('Title', KEYWORDS_HIT_KEYWORD_FIELDS[i][1])
        keyword_question = Question(identifier=KEYWORDS_HIT_KEYWORD_FIELDS[i][0],
                                    content=keyword_content,
                                    answer_spec=AnswerSpecification(keyword_fta),
                                    is_required=True if i <= 10 else False)
        question_form.append(keyword_question)

        definition_content = QuestionContent()
        definition_content.append_field('Title', KEYWORDS_HIT_DEFINITION_FIELDS[i][1])
        definition_question = Question(identifier=KEYWORDS_HIT_DEFINITION_FIELDS[i][0],
                                       content=definition_content,
                                       answer_spec=AnswerSpecification(definition_fta),
                                       is_required=False)
        question_form.append(definition_question)

    hit = connection.create_hit(questions=question_form, max_assignments=1,
                          title=title, description=KEYWORDS_HIT_DESCRIPTION,
                          keywords=KEYWORDS_HIT_KEYWORDS, duration=KEYWORDS_HIT_DURATION,
                          reward=KEYWORDS_HIT_REWARD, qualifications=KEYWORDS_HIT_QUALIFICATION,
                          annotation=str(note.id))[0]

    HIT.objects.create(HITId=hit.HITId, note=note, processed=False)
开发者ID:dangan249,项目名称:karmaworld,代码行数:55,代码来源:tasks.py

示例9: create_HIT

def create_HIT(mturk_conn, letter, imgur_links):
    # Given a char and set of links
    # create and push HIT
    try:
        canary = mturk_conn.get_account_balance()
    except Exception as e1:
        print "[Error Connecting]", e1
        print "[Exiting]"
        exit(1)

    hit = None
    # -HIT Properties
    title = "Select the Best Character"
    description = (
        "Of the available options below, please select the best representation of the following chracter: "
        + letter
        + "\n Your vote will help determine which character gets selected to be used in a collaborative typeface."
    )
    keywords = "image, voting, opinions"

    # -Question Overview
    overview = Overview()
    overview.append_field("Title", "Choose the best looking letter")

    # -Question
    qc1 = QuestionContent()
    qc1.append_field("Title", "Select Letter")

    # Generate Awnsers 1 per imgur_links[]
    choices = boto_injector(imgur_links)

    # -Awnser Choices
    fta1 = SelectionAnswer(min=1, max=1, style="radiobutton", selections=choices, type="binary", other=False)

    q1 = Question(identifier="design", content=qc1, answer_spec=AnswerSpecification(fta1), is_required=True)

    # -Question Form
    question_form = QuestionForm()
    question_form.append(overview)
    question_form.append(q1)

    # Put the HIT up
    try:
        mturk_conn.create_hit(
            questions=question_form,
            max_assignments=5,
            title=title,
            description=description,
            keywords=keywords,
            duration=60 * HIT_TIME,
            reward=0.01,
        )
        print "Hit issued for item:", letter
    except Exception as e1:
        print "Could not issue hit", e1
开发者ID:baykovr,项目名称:AMT,代码行数:55,代码来源:amt_voting.py

示例10: __generate_qualification_test

	def __generate_qualification_test(self, question_data, num_correct, title):
		'''
		Returns a QuestionForm and AnswerKey for a qualification test from a list of sentence dictionaries
		'''

		# Get question and answer data
		questions = map(lambda (i,x): self.__generate_qualification_question(x,i), enumerate(question_data))
		answers = map(lambda (i,x): x["answer_key_"+str(i)], enumerate(questions))
		answer_key = self.__generate_answer_key(answers, num_correct, len(question_data))

		# Create form setup
		qual_overview = Overview()
		qual_overview.append_field("Title",title)

		# Instructions
		qual_overview.append(FormattedContent("<h1>You must correctly code "+str(num_correct)+" out of the "+str(len(question_data))+" test sentences below.</h1>"))
		qual_overview.append(FormattedContent("<h2>Coding instructions are listed below. Please read through these carefully before continuing on to the coding task.</h2>"))
		inst_url = "https://s3.amazonaws.com/aws.drewconway.com/mt/experiments/cmp/html/instructions.html"
		qual_overview.append(FormattedContent('<iframe src="'+inst_url+'" frameborder="0" width="1280" height="300" scrolling="auto">This text is necessary to ensure proper XML validation</iframe>'))

		# Create question form and append contents
		qual_form = QuestionForm()
		qual_form.append(qual_overview)
		for q in questions:
			i = q["question_num"]
			qual_form.append(q["policy_area_"+str(i)])
			qual_form.append(q["econ_scale_"+str(i)])
			qual_form.append(q["soc_scale_"+str(i)])

		return (qual_form, answer_key)
开发者ID:xydinesh,项目名称:mturk_coder_quality,代码行数:30,代码来源:generate_qualification.py

示例11: createQualification

def createQualification(language): #returns the qualType
	title = "English to " + language + " Translator Qualification"
	descrip = "Obtain a qualification to complete tasks requiring translation from English to " + language
	status = 'Active'
	keywords = "qualification, translation"
	retry_delay = 10 #small for testing, should be alot bigger or not specified
	test_duration = 300 #5 minutes
	answer_key=None 
	answer_key_xml=None 
	auto_granted=False 
	auto_granted_value=1
	#string to check for translation:
	test_trans = "Siempre como huevos para desayuno cuando me despierto." #"I always eat eggs for breakfast when I wake up"
	#---------------  BUILD OVERVIEW -------------------
	 
	qual_overview = Overview()
	qual_overview.append_field('Title', title)
	qual_overview.append_field('Text' , descrip)
	
	#---------------  BUILD FREE TEXT ANSWER -------------------
	
	
	#---------------  BUILD QUESTION -------------------
	qual_qc = QuestionContent()
	qual_qc.append_field('Title','Please translate the sentence')
	qual_qc.append_field('Text', test_trans)		#This is where the actual question is printed
	
	qual_fta = FreeTextAnswer()
	 
	qual_q1 = Question(identifier="translation",
	              content=qual_qc,
	              answer_spec=AnswerSpecification(qual_fta))
	 
	#--------------- BUILD THE QUESTION FORM -------------------
	 
	qual_question_form = QuestionForm()
	qual_question_form.append(qual_overview)
	qual_question_form.append(qual_q1)
	
	#--------------- CREATE THE QUALIFICATION TYPE -------------------
	
	qualType = mtc.create_qualification_type(title, 
					descrip, 
					status, 
					keywords, 
					retry_delay,
					qual_question_form,	#the "test" value
					answer_key,
					answer_key_xml,
					test_duration,
					auto_granted,
					auto_granted_value)
					
	return qualType
开发者ID:gpaulu,项目名称:mTurkTranslation,代码行数:54,代码来源:mturk.py

示例12: make_question_form_elicitation_HIT

    def make_question_form_elicitation_HIT(self,prompt_list,hit_title,prompt_title,keywords,
                                  duration=DEFAULT_DURATION,reward_per_clip=DEFAULT_REWARD,max_assignments=DEFAULT_MAX_ASSIGNMENTS):
        overview = Overview()        
        overview.append_field("Title",hit_title)
        #overview.append(FormattedContent('<a target = "_blank" href="url">hyperlink</a>'))
        question_form = QuestionForm()
        
        descriptions = ["The following prompts are in English.",
                        "Approve the flash permissions to record audio.",                        
                        "Click the red circle to record yourself.",
                        "Read the words after 'prompt:'",
                        "Click 'Click to Stop'",
                        "Play the clip back to verify sound quality.",
                        "After you are happy with your recording, click 'Click here to save >>'",
                        "Copy & paste the URL under 'Sharing options' into the text field for the prompt.",
                        "You will NEVER be asked to divulge any personal or identifying information."
                        ]
        keywords = "audio, recording, elicitation, English"
        
#         for i, description in enumerate(descriptions):            
#             overview.append_field("%dDescription"%i, description)
#         flash_xml = FlashXml(self.flash_xml.replace(self.html_tags["flash_url"],self.vocaroo_url))
#         overview.append(flash_xml)
        question_form.append(overview)
        
        qc = QuestionContent()
#        qc.append(FormattedContent(flash_xml))
           
        qc.append_field("Title","Please select the type of microphone you are using.")
#         qc.append(Flash(self.vocaroo_url,525,450))
#         
        #answer = FreeTextAnswer()
        answer = SelectionAnswer(max=1,style="radiobutton",selections=self.mic_selections)
        q = Question(identifier="MIC",
                     content=qc,
                     answer_spec=AnswerSpecification(answer))
        question_form.append(q)

        qual = qualification.LocaleRequirement("in","USA")
        reward = reward_per_clip * len(prompt_list)
        xml = question_form.get_as_xml()
        try:
            response = self.conn.create_hit(questions=question_form,
                             max_assignments=1,
                             title=hit_title,
                             qualification= qual,
                             description=descriptions[0],
                             keywords=keywords,
                             duration=duration,
                             reward=reward)
        except MTurkRequestError as e:
            if e.reason != "OK":
                raise 
        return True
开发者ID:tturpen,项目名称:CrowdsourcedAutomaticSpeechRecognition,代码行数:54,代码来源:MechanicalTurk.py

示例13: make_poll

def make_poll(title, question, description, keywords, poll_price, ratings):
    """Take submitted request and answers.

    Resubmit for polling to ensure validity."""

    ACCESS_ID = mtkey.ACCESS_KEY
    SECRET_KEY = mtkey.SECRET_KEY

    HOST = 'mechanicalturk.amazonaws.com'
    # link to HITs: https://requester.mturk.com/mturk/manageHITs

    # HOST = 'mechanicalturk.sandbox.amazonaws.com'
    # link to HITs: https://requestersandbox.mturk.com/mturk/manageHITs

    mtc = MTurkConnection(aws_access_key_id=ACCESS_ID,
                          aws_secret_access_key=SECRET_KEY,
                          host=HOST)

    #---------------  BUILD OVERVIEW -------------------

    overview = Overview()
    overview.append_field('Title', title)

    #---------------  BUILD POLL  -------------------

    qc2 = QuestionContent()
    qc2.append_field('Title', question)

    fta2 = SelectionAnswer(min=1, max=4, style='checkbox',
                           selections=ratings,
                           type='text',
                           other=False)

    q2 = Question(identifier='selection',
                  content=qc2,
                  answer_spec=AnswerSpecification(fta2),
                  is_required=True)

    #--------------- BUILD THE POLL FORM -------------------

    question_form = QuestionForm()
    question_form.append(overview)
    question_form.append(q2)    

    #--------------- CREATE THE HIT -------------------

    return mtc.create_hit(questions=question_form,
                          max_assignments=8,
                          title=title,
                          description=description,
                          keywords=keywords,
                          duration=60*5,
                          reward=poll_price)
开发者ID:beatricep,项目名称:6-Mturk-Final-Project,代码行数:53,代码来源:makepoll.py

示例14: createHIT1

def createHIT1(to_trans,context):

	
	
	title = 'Translate a sentence into spanish!'
	description = ('For realz. Just translate this sentence.')
	keywords = 'translate, language'
	#qualifications = Qualificatiosn(qualificationType)
	
	#---------------  BUILD OVERVIEW -------------------
	 
	overview = Overview()
	overview.append_field('Title', title)
	overview.append(FormattedContent('<p>' + context + '</p>' + '<p><b>' + to_trans + '</b></p>'))
	 
	 
	#---------------  BUILD QUESTION 2 -------------------
	 
	qc1 = QuestionContent()
	qc1.append_field('Title','Please translate the bolded sentence')
	 
	fta1 = FreeTextAnswer()
	 
	q1 = Question(identifier="translation",
				  content=qc1,
				  answer_spec=AnswerSpecification(fta1))
	 
	#--------------- BUILD THE QUESTION FORM -------------------
	 
	question_form = QuestionForm()
	question_form.append(overview)
	question_form.append(q1)
	 
	#--------------- CREATE QUALIFICATION REQUIREMENT -------------------
	qual_req = Requirement(qualification_type_id=QUALIFICATION_ID,
					comparator="Exists")
	
	quals = Qualifications(requirements=[qual_req])
	#--------------- CREATE THE HIT ------------------- 
	resultSet = mtc.create_hit(questions=question_form,
				   max_assignments=HIT1_MAX_ASSIGN,
				   title=title,
				   description=description,
				   keywords=keywords,
				   duration = 60*5,
	               reward=0.50,
				   qualifications=quals)

	
	return resultSet[0].HITId
开发者ID:gpaulu,项目名称:mTurkTranslation,代码行数:50,代码来源:mturk.py

示例15: create_question

def create_question(batch, examples):
	"""
	Creates a QuestionForm for a batch of strings

	Args:
		batch (list) : List of pairs of strings to be matched
		examples (tuple) : Input examples for which HTML is to be generated

	Returns:
		question_form : QuestionForm object containing all question fields

	"""

	question_id = []
	question_form = QuestionForm()


	overview = Overview()
	overview.append_field('Title', title)
	
	#examples = ("(abc, aabc) - not match", "(abc, abc) - match")
	overview.append(FormattedContent(utils.gen_html_for_instruction(examples)))

	question_form.append(overview)

	for i in range(0,len(batch)):
		#print 'String 1  = ' + batch[i][0]
		#print 'String 2  = ' + batch[i][1]

		question_content = QuestionContent()
		text = 'String 1 = ' + batch[i][0] + '\n'
		text = text + 'String 2 = ' + batch[i][1] + '\n'
		question_content.append_field('Text', text)

		q_id = 'q' + str(i) + str(i+1)
		question_id.append(q_id)
		selection_answer = SelectionAnswer(min=1, max=1,style='radiobutton',
	                      selections=matches,
	                      type='text',
	                      other=False)
	 
		question = Question(identifier=q_id,
	              content=question_content,
	              answer_spec=AnswerSpecification(selection_answer),
	              is_required=True)

		question_form.append(question)

	return question_form
开发者ID:kirthan18,项目名称:stringsimjoin_crowd,代码行数:49,代码来源:crowdsourcing.py


注:本文中的boto.mturk.question.Overview类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。