Mechanical Turk / Cmd 行工具 / 资格 / xml 中的 #set 和 #foreach
在 Amazon Mechanical Turk 命令行工具(我使用的版本:aws-mturk-clt-1.3.0)中,在示例之一(site_filter_qual:“网站过滤资格”,文件 site_filter_qual.question)中,有一些代码看起来像这样的事情:
#set( $urls = [ "http://news.bbc.co.uk/", http://..., ...])
#foreach ( $url in $urls )
...
我想知道:
- a)这里使用的语言是什么(它是 不是 Perl 也不是 PHP,对吧?);
- b) 我在哪里(在亚马逊网站或其他地方) 可以阅读这些结构;
- c) 如何实现元组(对),例如
// 在 Python 中:
>> data = [("http://news.bbc.com", "NEWS"), ("http://google.com", "SEARCH"), ...]
>> for (url, category) in data:
>> ....
-- 或类似的东西?
提前致谢!
In the Amazon Mechanical Turk command line tools (I am using version: aws-mturk-clt-1.3.0), in one of the samples (site_filter_qual: "Website Filtering Qualification", file site_filter_qual.question), there is code that looks something like this:
#set( $urls = [ "http://news.bbc.co.uk/", http://..., ...])
#foreach ( $url in $urls )
...
I am wondering :
- a) What is the language used here (it's
not Perl and not PHP, right?); - b)
Where (on Amazon site or elsewhere) I
could read about these constructs; - c)
How to implement tuples (pairs), e.g.
// in Python:
>> data = [("http://news.bbc.com", "NEWS"), ("http://google.com", "SEARCH"), ...]
>> for (url, category) in data:
>> ....
-- or something similar?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它是一个 Velocity 模板(Apache 项目的一部分)。好消息是它是一种相当灵活的语言,您可以操作。更好的消息是,您可以(因为我相信所有 CLT 和 SDK 代码都是开放的)实际上创建新的构造来覆盖或扩展不属于 Velocity 开箱即用的任何内容。
直接回答您的问题:
a) Velocity
b) http://velocity.apache.org/
c)您可以使用两个单独的数组。我意识到这并不漂亮,但它会起作用。
It's a Velocity template (part of the Apache project). The good news is that it's a reasonably flexible language that you can manipulate. The better news is that you can (since I believe all the CLT and SDK code is open) actually create new constructs to override or expand on anything that's not part of Velocity out-of-the-box.
To answer your questions directly:
a) Velocity
b) http://velocity.apache.org/
c) You can use two separate arrays. Not pretty, I realize, but it'll work.