谷歌搜索了一下,但我想我不知道如何表达我的问题:
我有一个带有一系列问题的客户端 javascript 应用程序。
var questions = [
'How are you?',
'Where are you?',
'How far away is the sun?'
];
我想将一个新问题与一系列现有问题进行比较:
var newQuestion = "How are you doing today?";
是否有一个现有的客户端 javascript 库可以将新问题复制到现有问题数组中并返回如下结果:
[
{
original: "How are you?",
similarity: .80
},
{
original: "Where are you?",
similarity: .71
},
{
original: "How far away is the sun?",
similarity: .13
}
]
任何意见将是有益的!