2017-08-25 113 views
0

我正在使用Python包字袋,bow.pyhttps://github.com/dmiro/bagofwords/blob/master/bow.py)。PyStemmer:ImportError:DLL加載失敗:動態鏈接庫(DLL)初始化例程失敗

基本上我運行以下命令:

dc = bow.DefaultDocument() 
dc.read_text("paragraph string here") 

我得到以下跟蹤:

Traceback (most recent call last): 
    File "bag_of_words.py", line 93, in <module> 
    if __name__ == "__main__": main() 
    File "bag_of_words.py", line 27, in main 
    bag_of_words_classifier_test("item", "category_1", "category_2") 
    File "bag_of_words.py", line 73, in bag_of_words_classifier_test 
    dc.read_text("paragraph string here") 
    File "C:\Users\User Name\Anaconda3\lib\site-packages\bow.py", line 339, in read_text 
    self._read(None, text) 
    File "C:\Users\User Name\Anaconda3\lib\site-packages\bow.py", line 326, in _read 
    words = self.tokenizer(text) 
    File "C:\Users\User Name\Anaconda3\lib\site-packages\bow.py", line 306, in tokenizer 
    words = self.after_tokenizer(WordFilters, words) 
    File "C:\Users\User Name\Anaconda3\lib\site-packages\bow.py", line 517, in after_tokenizer 
    words = wordfilters.stemming(self.lang, self.stemming, words) 
    File "C:\Users\User Name\Anaconda3\lib\site-packages\bow.py", line 250, in stemming 
    import Stemmer as stemmer 
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. 

我想這可能是與PyStemmer一個問題,所以我試圖迫使PIP3重裝/升級但得到相同的錯誤。有什麼想法嗎?

回答

0

好了,所以這並不能真正解決問題,但它是一個解決方法:

如果你打開bow.py你可以import snowballstemmer as stemmer(而不是import Stemmer as stemmer)取代線250,然後將其替換線252 stemmer = stemmer.stemmer(lang)(而不是stemmer = stemmer.Stemmer(lang))。等價的方法只需要從大寫更改爲小寫。

相關問題