Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

zhuweiyou/weixin-game-helper-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

search

GPL-3.0 Build Status

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

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

安装

npm install github:zhuweiyou/weixin-game-helper-search

示例

const search = require('weixin-game-helper-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) // 匹配度最高的答案
})()