Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.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
Python 无法用嗖嗖声搜索非英语(印地语)单词?_Python_Json_Python 3.x_Whoosh - Fatal编程技术网

Python 无法用嗖嗖声搜索非英语(印地语)单词?

Python 无法用嗖嗖声搜索非英语(印地语)单词?,python,json,python-3.x,whoosh,Python,Json,Python 3.x,Whoosh,我有来自印地语api的json转储。首先,我得到了这些json文件: def retrieve_data(): '''Get articles from api and save locally.''' i = 1 while True: articles = get_articles(page_no=i) if not articles or len(articles) < 1: break

我有来自印地语api的
json
转储。首先,我得到了这些
json
文件:

def retrieve_data():
    '''Get articles from api and save locally.'''
    i = 1
    while True:
        articles = get_articles(page_no=i)
        if not articles or len(articles) < 1:
            break
        with open('dumps/%d.json' % i, 'w') as ijson:
            json.dump(articles, ijson, ensure_ascii=False)
            # I also tried
            # json.dump(articles, ijson)
        i = i+1
def retrieve_data():
''从api获取文章并保存在本地''
i=1
尽管如此:
文章=获取文章(第i页)
如果不是物品或透镜(物品)<1:
打破
将open('dumps/%d.json'%i',w')作为ijson:
dump(articles,ijson,sure_ascii=False)
#我也试过了
#dump(articles,ijson)
i=i+1
现在,在索引之后,当我搜索不同的印地语单词时,我得到了混合的结果

例如:
नरेंद् मोदी
是在我的索引文章中多次出现的人名。当我搜索
नरेंद्
,我很容易获得所有匹配项,但当我搜索
मोदी,我无法得到一个结果。同样的事情也发生在不同的印地语单词上,有些我得到了结果,但另一些我没有


我无法理解这里出了什么问题。因为对于英语单词,我的“嗖嗖”搜索非常有效,我没有遇到任何问题。这就是为什么我认为我的whoosh代码是正确的。

它适用于英语,因为分析器和标记器适用于英语。您能提供调用whoosh API的代码来索引文档吗?它适用于英语,因为analyzer和tokenizer适用于英语。您能否提供调用whoosh API的代码来索引文档。