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


Python Overview.append_field方法代码示例

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


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

示例1: make_question_form_HIT

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
    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,代码行数:32,代码来源:MechanicalTurk.py

示例2: generate_hit

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
  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,代码行数:62,代码来源:mturk_vote_sentence.py

示例3: __generate_qualification_test

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
    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.
                question_data : json object containing all the questions.
        '''

        # 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>Please answer all the questions below.</h1>"))
        qual_overview.append(FormattedContent("<h2>For each question, please choose either the left or right image \
            which you think is more beautiful in terms of its composition. Hints: Please make your decision based on\
            several 'rules of thumb' in photography, such as rule of thirds, visual balance and golden ratio. \
            You may also make your decision by judging which image contains less unimportant or distracting contents.</h2>"))

        # 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["question_"+str(i)])

        return (qual_form, answer_key)
开发者ID:yiling-chen,项目名称:flickr-cropping-dataset,代码行数:34,代码来源:generate_qualification.py

示例4: createHits

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:35,代码来源:mturkconnector.py

示例5: __generate_qualification_test

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
	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,代码行数:32,代码来源:generate_qualification.py

示例6: createHIT2

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:61,代码来源:mturk.py

示例7: create_question_form

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:59,代码来源:mturk_img_upload.py

示例8: post_HIT1

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
def post_HIT1(ACCESS_ID,SECRET_KEY,HOST,url_to_task):
    mtc = MTurkConnection(aws_access_key_id=ACCESS_ID,
                      aws_secret_access_key=SECRET_KEY,
                      host=HOST)
 
    title = 'Dev deploying simulation test Report From SERVER'
    description = ('Report on events in a simulation')
    keywords = 'website, rating, opinions'
    instructions=('<p>You will take part in a web-based experiment where you will watch a simple simulation and provide reports on events</p>'
                 '<p>Instructions:</p>'
                  '<p>1. Click the link below, which will open the webpage in a new window in your browser</p>'
                  '<p>2. Follow the instructions on the website</p>'
                  '<p>3. Once you have completed your work, you will receive a Reward Code</p>'
                  '<p>4. Return to the mechanical turk webpage and enter your code in the Reward Code text box</p>'
                  '<p>5. Your work will then be checked, after which you will receive your payment</p>'
                  '<br/>CLICK "ACCEPT HIT" BEFORE FOLLOWING LINK'
                  '<br/>YOU WILL NOT BE PAID WITHOUT ACCEPTING THE HIT')
                    
                    
    #---------------  BUILD OVERVIEW -------------------
     
    overview = Overview()
    overview.append_field('Title', description)
    overview.append(FormattedContent(instructions))
    overview.append(FormattedContent('<p>Click "Accept HIT" then click this link <a target="_blank"'
                                     ' href="'+url_to_task+'">'
                                     ' Link to task</a></p>'))
 
    #---------------  BUILD QUESTION 1 -------------------
     
    qc1 = QuestionContent()
    qc1.append_field('Title','Enter reward code here:')
     
    fta1 = FreeTextAnswer(num_lines=1)
    
    q1 = Question(identifier='reward_code',
                  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 THE HIT -------------------
     
    mtc.create_hit(questions=question_form,
                   max_assignments=1,
                   title=title,
                   description=description,
                   keywords=keywords,
                   duration = 60*5,
                   reward=0.05)
开发者ID:qwertyfingers,项目名称:crowd_web,代码行数:59,代码来源:post_exp_test.py

示例9: launchHIT

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:59,代码来源:boto_wrapper.py

示例10: create_question_form

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:11,代码来源:mturk.py

示例11: create_HIT

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:57,代码来源:amt_voting.py

示例12: createQualification

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:56,代码来源:mturk.py

示例13: make_question_form_elicitation_HIT

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
    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,代码行数:56,代码来源:MechanicalTurk.py

示例14: make_poll

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:55,代码来源:makepoll.py

示例15: createHIT1

# 需要导入模块: from boto.mturk.question import Overview [as 别名]
# 或者: from boto.mturk.question.Overview import append_field [as 别名]
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,代码行数:52,代码来源:mturk.py


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