我正在研究NLP上的一个模块,他们使用这个语法“创建一个字典,将我们从一个单词映射到单词嵌入矩阵中的索引。”index = {word: i for i, word in enumerate(english_words)}
我以前从没见过用I作为我的循环。我相信我理解它在做什么(取索引i中的每个单词,并将其映射到english_words中的相应单词。但是,这个语法实际上是如何工作的呢?其他语言是否使用这个语法,还是这个python特有的?
即使使用raw或html_safe<%= button_to(glyphicon('heart', 'I love it !'), some_path, class: "btn btn-success")%>def glyphicon(glyph, text = nil)
html = "<i class=\"glyphicon glyphicon-#{glyph}\"><