快速文本类型错误:():不兼容的函数参数



我正在尝试使用fasttext监督分类器来训练我的分类器系统,如下所示:
我的txt文件头是:

__label__0A001 0a001 “nuclear reactors” and specially designed or prepared equipment and components therefor, as follows: a. “nuclear reactors”; b. metal vessels, or major shopfabricated parts therefor, including the reactor vessel head for a reactor pressure vessel, specially designed or prepared to contapin the core of a “nuclear reactor”;  
__label__0B001 0b001 plant for the separation of isotopes of “natural uranium”, “depleted uranium” and “special fissile materials”, and specially designed or prepared equipment and components therefor, other than analytical instruments, as follows: a. plant specially designed for separating isotopes of “natural uranium”, “depleted uranium”, and “special fissile materials”
import fasttext
model = fasttext.train_supervised(input='myfile.txt')

然而,我得到了这个错误:

Traceback (most recent call last):
File "C:/Users/u5712005/PycharmProjects/recognize_dsgl_risky_research/Risky_researcher_DSGL/recognize_dsgl_risky_research/fasttext_main.py", line 53, in <module>
model = fasttext.train_supervised(input=path.lookuptable_keyphrases_fasttext)
File "C:Usersu5712005Anaconda3libsite-packagesfasttextFastText.py", line 529, in train_supervised
a = _build_args(args, manually_set_args)
File "C:Usersu5712005Anaconda3libsite-packagesfasttextFastText.py", line 421, in _build_args
setattr(a, k, v)
TypeError: (): incompatible function arguments. The following argument types are supported:
1. (self: fasttext_pybind.args, arg0: str) -> None
Invoked with: <fasttext_pybind.args object at 0x0000020F3B47EEF0>, WindowsPath('C:/Users/u5712005/PycharmProjects/recognize_dsgl_risky_research/Risky_researcher_DSGL/data/Output_data/DSG_lookup_fasttext_table.txt')

有什么建议吗?

Masi

看起来您使用的是Windows操作系统。Facebook的主要FastText页面上写着:

通常,fastText构建在现代Mac OS和Linux发行版上。

其官方Python包装器的页面上写着:

fastText构建在现代Mac OS和Linux发行版上。由于它使用C++11特性,因此需要一个具有良好C++11支持的编译器。您将需要Python(版本2.7或≥3.4(,NumPy&SciPy和pybind11。

我在这些页面上没有看到任何关于Windows支持的内容,所以核心软件包可能没有经过设计或测试,无法在Windows上开箱即用。

纵观该项目的Github问题,有许多与尝试在Windows上运行它有关的开放和封闭问题。有些人通过额外的步骤或可能通过使用其他来源的非官方车轮来提及成功。

如果你需要使用Windows,你可能会幸运地搜索到这些问题。

如果你不需要使用Windows,那么Python数据科学堆栈的大部分都经过了更好的测试;在MacOS或Linux上受支持。

相关内容

最新更新