Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.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 nltk:使用自定义特征集的文本分类_Python_Text_Python 3.x_Classification_Nltk - Fatal编程技术网

Python nltk:使用自定义特征集的文本分类

Python nltk:使用自定义特征集的文本分类,python,text,python-3.x,classification,nltk,Python,Text,Python 3.x,Classification,Nltk,我的数据集如下所示: featureDict = {identifier1: [[first 3-gram], [second 3-gram], ... [last 3-gram]], ... identifierN: [[first 3-gram], [second 3-gram], ... [last 3-gram]]} 另外,我还有一套相同文件的标签: labelDict = {identifier1: label1,

我的数据集如下所示:

featureDict = {identifier1: [[first 3-gram], [second 3-gram], ... [last 3-gram]],
               ...
               identifierN: [[first 3-gram], [second 3-gram], ... [last 3-gram]]}
另外,我还有一套相同文件的标签:

labelDict = {identifier1: label1,
             ...
             identifierN: labelN}
我想找出最合适的nltk容器,在其中我可以将这些信息存储在一个地方,并无缝地应用nltk分类器

此外,在使用此数据集上的任何分类器之前,我还希望在此功能空间上使用tf idf过滤器


参考资料和文档将很有帮助。

您只需要一个简单的记录。请查看中的代码片段

这方面的参考文档仍然是nltk手册:和API规范:

以下是一些可能对您有所帮助的页面:


此外,请记住,nltk在其提供的分类器算法方面是有限的。对于更高级的探索,您最好使用scikit learn。

您只需要一个简单的dict。请查看中的代码片段

这方面的参考文档仍然是nltk手册:和API规范:

以下是一些可能对您有所帮助的页面:

此外,请记住,nltk在其提供的分类器算法方面是有限的。对于更高级的探索,最好使用scikit learn