Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从Java中的数据库中找到单词的相似匹配项?_Java_Sqlite - Fatal编程技术网

如何从Java中的数据库中找到单词的相似匹配项?

如何从Java中的数据库中找到单词的相似匹配项?,java,sqlite,Java,Sqlite,我目前的编程项目是一种Java法语词典(使用sqlite)。我想知道如果有人想找到“avoir”的现在时,但输入了“avior”,会发生什么,我会如何处理它。所以我想我可以实现某种最接近的匹配/你指的是功能吗。所以我的问题是: 有没有办法使用数据库来搜索类似的匹配项 不久前,当我用python编写相同的程序时(改用xml),我使用了这个系统,但它不是非常有效,并且需要很大的错误空间才能达到一定的效果(随后建议使用与此无关的单词!)。。。但类似的东西还是有用处的 def getSimilar(se

我目前的编程项目是一种Java法语词典(使用sqlite)。我想知道如果有人想找到“avoir”的现在时,但输入了“avior”,会发生什么,我会如何处理它。所以我想我可以实现某种最接近的匹配/你指的是功能吗。所以我的问题是:

有没有办法使用数据库来搜索类似的匹配项

不久前,当我用python编写相同的程序时(改用xml),我使用了这个系统,但它不是非常有效,并且需要很大的错误空间才能达到一定的效果(随后建议使用与此无关的单词!)。。。但类似的东西还是有用处的

def getSimilar(self, word, Return = False):
    matches = list()
    for verb in self.data.getElementsByTagName("Verb"):
        for x in range(16):
            if x % 2 != 0 and x>0:
                if (x == 15 or x == 3 or x == 1): 
                    part = Dict(self.data).removeBrackets(Dict(self.data).getAccents(verb.childNodes[x].childNodes[0].data)) 
                    diff = 0
                    for char in word:
                        if (not char in part):
                            diff += 1
                    if (diff < self.similarityValue) and (-self.errorAllowance <= len(part) - len(word) <= self.errorAllowance):
                        matches.append(part)
                else:
                    for y in range(14): 
                        if (y % 2 != 0 and y>0):
                            part = Dict(self.data).getAccents(verb.childNodes[x].childNodes[y].childNodes[0].data)
                            diff = 0
                            for char in word:
                                if (not char in part):
                                    diff += 1
                            if (diff < self.similarityValue) and (-self.errorAllowance <= len(part) - len(word) <= self.errorAllowance):
                                matches.append(part)
    if not Return:
        for match in matches:
            print "Did you mean '" + match + "'?"
    if Return: return matches
def getsimilor(self、word、Return=False):
匹配项=列表()
对于self.data.getElementsByTagName(“动词”)中的动词:
对于范围(16)内的x:
如果x%2!=0和x>0:
如果(x==15或x==3或x==1):
part=Dict(self.data).移除括号(Dict(self.data).getAccents(动词.childNodes[x].childNodes[0].data))
差异=0
对于word中的字符:
如果(不是部分字符):
差值+=1
如果(差异

工作非常好

我如何使用sqlite manager将此功能添加到我的数据库中,我无法确定Hahain指令在make文件中老实说…它们对我没有任何意义hahaIm也不确定是否热安装抱歉,请尝试cygwin?