game-helper / search

基于搜索引擎的问答匹配度查询

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

search

GPL-3.0 Build Status

基于搜索引擎的问答匹配度查询,目前使用了百度和搜狗搜索

目前用于 game-helper/weixin 答题类辅助,没有正确答案时提交推荐答案

安装

npm i game-helper/search

示例

const search = require('search')

;(async () => {
  const {result, index, maxIndex, minIndex} = await search({
    question: '《红楼梦》的作者是谁?',
    options: [
      '施耐庵',
      '吴承恩',
      '曹雪芹',
      '罗贯中'
    ]
  })
  console.log(result) // [0, 0, 13,0] 数值越大的表示搜索结果越匹配,理论上该选项为正确答案的几率更高
  console.log(index) // 2 推荐的答案,一般为匹配度最高的答案(如果题目中包含否定词汇,匹配度最低为推荐答案)
  console.log(minIndex) // 匹配度最低的答案
  console.log(maxIndex) // 匹配度最高的答案
})()

About

基于搜索引擎的问答匹配度查询

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%