Sha256: 0634ef79cf5d3624b9c015fb28001c0a8e1597b9a3e2ea99c9111fc6c7b6ed25
Contents?: true
Size: 1.24 KB
Versions: 11
Compression:
Stored size: 1.24 KB
Contents
<h1> 批量导入 </h1> <div> <h2>格式说明</h2> <p> 每行的规则如下所示 </p> <pre><code> key, rule_str = line.split('=') rules = rule_str.split('|') ugc = parse(rules[0]).blank? ? 'replace' : parse(rules[0]) username = parse(rules[1]) || 'ignore' signature = parse(rules[2]) || 'ignore' dialog = parse(rules[3]) || 'ignore' nickname = parse(rules[1]) || 'ignore' replacement = ugc == 'replace' ? rules[0] : '**' # 其中 parse 为 def parse(rule) return nil if rule.blank? r = rule.match(/^{(\w+)}$/) r.blank? ? nil : r[1].downcase end </code></pre> <p> 即 关键字=场景规则 </p> <p>规则用 "|" 分开, 规则 0 为 ugc, 规则 1 为 username或 nickname, 规则 2 为签名, 规则3 为对话 </p> <p>规则值可以为 <%= CensorBear::StopWord::ACTIONS_MAP.join(", ") %>, ugc 较为特殊, 可为其他值, 该其他值作为替换值 </p> <%= form_with url: import_confirm_stop_words_path, method: :post do |f| %> <%= f.file_field :file%> <%= f.label :is_overwrite, "覆盖相同敏感词?" %> <%= f.check_box :is_overwrite, {}, true, false %> <%= f.submit%> <% end %> </div>
Version data entries
11 entries across 11 versions & 1 rubygems