I installed the weka python wrapper on Windows 7. And I tried to run the sample code:
import weka.core.jvm as jvm jvm.start () data_dir = "e: / files / fourth /" from weka.core.converters Loader Loader = Loader ("weka.core.converters.TextDirectoryLoader") Import Dataset = [Data_dir + "File 1", Data_DER + "File2", Data_DER + "File3", Data_DER + "File4", Data_Drad + "File 5"] data = loader.load_file (dataset) data. Delete_last_attribute () print (data)
and I found the following error:
traceback (Most recent call final): The file "C: /Python27/weekaa.py" Nkti 16, & lt; Module & gt; Data = loader.load_file (dataset) file "C: \ Python27 \ lib \ site-packages \ weka \ core \ converters.py", line 67, self_en_file (self.jsg.com, "weka.core.converters FileSourcedConverter in load_file ") TypeError:" C: Python27 \ lib \ site-packages \ weka \ core \ classes.py ", line 155, enforce_type raise TypeError (" does not apply the object or subclass "+ intf_or_class +"! ") TypeError: The object does not apply to weka.core.converters.FileSourcedConverter or does not subclass!
I tried to solve the problem by adding the square path of weka.jar or python-weka-wrapper in the last FAQ (in Stakeoverflow), but did not work. The error does not appear when loading the file.
Is there a solution to load text files?
Note: Text document files are set in each file in the dataset (for
Visa's textdirectory loader
class can not be used with dragon-vector-wrapper until version 0.2.2. Or) contains a new python wrapper called TextDirectoryLoader
weka.core.converters
module which allows you to use this category now. C
No comments:
Post a Comment