使用CreateHTMLQuestion命令在R中创建MTurk Hit

时间:2013-04-02 16:37:13

标签: html5 r mechanicalturk

我想在R中使用MTurK包创建一个Mechanical Turk Hit。 我正在使用的R代码如下:

filecontent <- GenerateHTMLQuestion(file="file.html")
print(filecontent)
#filestring <- filecontent [["string"]]
#filestring <- filecontent [["xml.parsed"]]
#filestring <- filecontent [["url.encoded"]]
filecontentForQuestion <- filecontent$string
filecontentForQuestion <- filecontent$xml
filecontentForQuestion <- filecontent$url
print(filecontentForQuestion)
testhit<-CreateHIT(question=filecontentForQuestion,
         title="Title",
         description="Description",
         keywords="Keyword",
         reward="0.05",
         assignments="3",
         duration="3600",
         expiration="20000",
         auto.approval.delay="2590000",
         qual.req=GenerateQualificationRequirement("Approved",">","5"),
     browser = F,
     sandbox=T)

我已尝试过每个不同的文件内容,但在使用此命令时总是会出错。不幸的是,我总是收到以下错误:

Error (AWS.MechanicalTurk.HTML5ParseError): There was an error parsing the
  HTML5 data in your request.  Please make sure the data is 
  well-formed and validates as HTML5

但是,我使用的html文件是MTurk API手册中的文件,如下所示:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/ex
ternalHIT_v1.js'></script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='ht
tps://www.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>
<h1>What's up?</h1>
<p><textarea name='comment' cols='80' rows='3'></textarea></p>
<p><input type='submit' id='submitButton' value='Submit' /></p></form>
<script language='Javascript'>turkSetAssignmentID();</script>
</body>
</html>

如果我使用一个完整的空html5文档,只有必要的占位符,我会得到同样的错误。有谁有想法,为什么这不起作用?

使用hitlayoutid参数或ExternalQuestion命令工作,所以我想显式使用GenerateHTMLQuestion命令。

0 个答案:

没有答案