使用weka转换器将csv文件转换为arff文件,但它没有计算足够的列

问题描述 投票:0回答:1

对于一个大学项目,我尝试使用 GUI 中的 Weka CSVLoader 将 CSV 转换为 ARFF。在选项中,我将字符串的括弧字符设置为 ",尽管我的文件中没有引号。我收到以下错误:

weka.core.converters.CSVLoaderfailed to lead Reason: wrong number of values. Read 20, expected 22, read Token[EOL], line 3215

我不明白为什么在有 22 列的情况下只读取 20 列

这是第 3214 行:

7030878916,https://cleveland.craigslist.org/apa/d/cleveland-your-next-home-awaits-at/7030878916.html,cleveland,https://cleveland.craigslist.org,825,apartment,1100,2,2,0,0,1,0,0,0,?,?,yes,"Green grass and a brick facade welcome you to Moreland Manor Apartments. Our affordable Shaker Heights, OH, apartments are equipped with everything you need to live well in the Lee-Van Aken area.  Available in one and two bedroom suites, the apartments for rent at Moreland Manor are quiet and secluded for your comfort. For further peace of mind, we feature secure-access entry. Inside each of our homes you will find a spacious floor plan with modern kitchen. We supply a refrigerator, dishwasher, and range.",41.4714,-81.5839,oh

这是第 3215 行:

7046602013,https://cleveland.craigslist.org/apa/d/lakewood-west-lakewood-upstairs-2-bdrm/7046602013.html,cleveland,https://cleveland.craigslist.org,1100,apartment,900,2,1,0,0,1,0,0,0,w/d hookups,?,yes,2 bedroom upstairs apartment in West Lakewood with updated kitchen and bathroom including central air and dishwasher. 7 minute walk to both Downtown Lakewood and Lakewood Park. Large balcony. Hookups for washer and dryer in basement. Short term lease with opportunity for extension. First month's rent and deposit due upon signing of lease.,41.4902,-81.8058,oh

这是第 3216 行:

7029945333,https://cleveland.craigslist.org/apa/d/euclid-2-bedroom-15-bathroom-suite-on/7029945333.html,cleveland,https://cleveland.craigslist.org,859,apartment,1000,2,1.5,0,0,1,0,0,0,laundry in bldg,off-street parking,yes,"At GreenRidge on Euclid we go out of our way to make you feel at home by encouraging you to showcase your individuality, Choose from six different 1 and 2 bedroom floor plans and personalize your apartment with your choice of vertical blind accents, accent paint colors, and carpet colors!  Greenridge on Euclid can be found on Euclid Avenue with access to Route 2, I-90 & I-271. Located just a few minutes from downtown Cleveland and the shopping and dining areas of Cleveland's East Side.  Contact us via phone about apartment 2b today! Call Paul at   show contact info .  Available Monday - Friday 8:00 am - 5:00 pm and Saturday by Appointment.  All apartments feature eight inches of solid concrete between each suite these apartments are built to keep sounds at home, spacious closets with full length mirrored doors and most have both dining rooms and eat-in kitchens. Luxurious wall to wall carpeting complements the living, dining and bedrooms while the kitchens & bathrooms are furnished with ceramic or no wax floors. Standard equipment for the kitchens includes a gas range with a sealed cooktop and self-cleaning oven, energy saving two door frost free refrigerator/freezer, energy star dishwasher, garbage disposal, range hood exhaust fan, and a stainless steel sink with extendable spout faucet. Wood cabinets with easy clean butcher block counter tops and a pantry complete the kitchen.  It all adds up to the smart alternative to downtown living, the apartment you deserve and a lifestyle you can afford!  At Greenridge on Euclid you'll enjoy: ,Bigger Suites,Environmentally friendly LED light fixtures,Free Heat & All Utilities (except electricity, phone & cable),Every room has at least one power outlet with a built in USB charger.,Individual Control of Heat & A/C by Programmable Thermostats,On-site Health Club & Free Wi-Fi* (coming soon),In-suite thermostat  to control heat and central air conditioning,Emergency Maintenance 24/7,Bright, Clean Laundry Room open 24/7,Package Delivery Acceptance,Smoke-Free Common Areas,An Intercom System that Connects Visitors to Your Cell Phone,24/7 Interior and Exterior Video Surveillance  http://www.greenridgeoneuclid.com https://www.facebook.com/Greenridge-on-Euclid-533365966869525/ https://twitter.com/GreenridgeEuc",41.6025,-81.5258,oh

有什么想法吗?我找不到错误

127以上的所有asci字符都已被删除,所有空格都已用?填充,但并没有改变这一行找到了多少列

csv weka arff
1个回答
0
投票

问题出在文本单元格中的单引号中。 Weka 的 CSVLoader 对转义此类字符很敏感。

为了将其转换为 Weka 的本机 CSVLoader 可以处理的格式,我执行了以下操作:

  1. 输入数据
7030878916,https://cleveland.craigslist.org/apa/d/cleveland-your-next-home-awaits-at/7030878916.html,cleveland,https://cleveland.craigslist.org,825,apartment,1100,2,2,0,0,1,0,0,0,?,?,yes,"Green grass and a brick facade welcome you to Moreland Manor Apartments. Our affordable Shaker Heights, OH, apartments are equipped with everything you need to live well in the Lee-Van Aken area. Available in one and two bedroom suites, the apartments for rent at Moreland Manor are quiet and secluded for your comfort. For further peace of mind, we feature secure-access entry. Inside each of our homes you will find a spacious floor plan with modern kitchen. We supply a refrigerator, dishwasher, and range.",41.4714,-81.5839,oh
7046602013,https://cleveland.craigslist.org/apa/d/lakewood-west-lakewood-upstairs-2-bdrm/7046602013.html,cleveland,https://cleveland.craigslist.org,1100,apartment,900,2,1,0,0,1,0,0,0,w/d hookups,?,yes,2 bedroom upstairs apartment in West Lakewood with updated kitchen and bathroom including central air and dishwasher. 7 minute walk to both Downtown Lakewood and Lakewood Park. Large balcony. Hookups for washer and dryer in basement. Short term lease with opportunity for extension. First month's rent and deposit due upon signing of lease.,41.4902,-81.8058,oh
7029945333,https://cleveland.craigslist.org/apa/d/euclid-2-bedroom-15-bathroom-suite-on/7029945333.html,cleveland,https://cleveland.craigslist.org,859,apartment,1000,2,1.5,0,0,1,0,0,0,laundry in bldg,off-street parking,yes,"At GreenRidge on Euclid we go out of our way to make you feel at home by encouraging you to showcase your individuality, Choose from six different 1 and 2 bedroom floor plans and personalize your apartment with your choice of vertical blind accents, accent paint colors, and carpet colors! Greenridge on Euclid can be found on Euclid Avenue with access to Route 2, I-90 & I-271. Located just a few minutes from downtown Cleveland and the shopping and dining areas of Cleveland's East Side. Contact us via phone about apartment 2b today! Call Paul at show contact info . Available Monday - Friday 8:00 am - 5:00 pm and Saturday by Appointment. All apartments feature eight inches of solid concrete between each suite these apartments are built to keep sounds at home, spacious closets with full length mirrored doors and most have both dining rooms and eat-in kitchens. Luxurious wall to wall carpeting complements the living, dining and bedrooms while the kitchens & bathrooms are furnished with ceramic or no wax floors. Standard equipment for the kitchens includes a gas range with a sealed cooktop and self-cleaning oven, energy saving two door frost free refrigerator/freezer, energy star dishwasher, garbage disposal, range hood exhaust fan, and a stainless steel sink with extendable spout faucet. Wood cabinets with easy clean butcher block counter tops and a pantry complete the kitchen. It all adds up to the smart alternative to downtown living, the apartment you deserve and a lifestyle you can afford! At Greenridge on Euclid you'll enjoy: ,Bigger Suites,Environmentally friendly LED light fixtures,Free Heat & All Utilities (except electricity, phone & cable),Every room has at least one power outlet with a built in USB charger.,Individual Control of Heat & A/C by Programmable Thermostats,On-site Health Club & Free Wi-Fi* (coming soon),In-suite thermostat to control heat and central air conditioning,Emergency Maintenance 24/7,Bright, Clean Laundry Room open 24/7,Package Delivery Acceptance,Smoke-Free Common Areas,An Intercom System that Connects Visitors to Your Cell Phone,24/7 Interior and Exterior Video Surveillance http://www.greenridgeoneuclid.com https://www.facebook.com/Greenridge-on-Euclid-533365966869525/ https://twitter.com/GreenridgeEuc",41.6025,-81.5258,oh
  1. 使用Weka Explorer中的Common CSV加载器(Weka包项目页面)加载上述CSV文件。我还检查了 noHeader 选项。

  2. 将数据保存为CSV文件(即使用Weka的原生CSVVaver)

这将为您提供以下内容:

att-1,att-2,att-3,att-4,att-5,att-6,att-7,att-8,att-9,att-10,att-11,att-12,att-13,att-14,att-15,att-16,att-17,att-18,att-19,att-20,att-21,att-22
7030878916,https://cleveland.craigslist.org/apa/d/cleveland-your-next-home-awaits-at/7030878916.html,cleveland,https://cleveland.craigslist.org,825,apartment,1100,2,2,0,0,1,0,0,0,'?','?',yes,'Green grass and a brick facade welcome you to Moreland Manor Apartments. Our affordable Shaker Heights, OH, apartments are equipped with everything you need to live well in the Lee-Van Aken area. Available in one and two bedroom suites, the apartments for rent at Moreland Manor are quiet and secluded for your comfort. For further peace of mind, we feature secure-access entry. Inside each of our homes you will find a spacious floor plan with modern kitchen. We supply a refrigerator, dishwasher, and range.',41.4714,-81.5839,oh
7046602013,https://cleveland.craigslist.org/apa/d/lakewood-west-lakewood-upstairs-2-bdrm/7046602013.html,cleveland,https://cleveland.craigslist.org,1100,apartment,900,2,1,0,0,1,0,0,0,'w/d hookups','?',yes,'2 bedroom upstairs apartment in West Lakewood with updated kitchen and bathroom including central air and dishwasher. 7 minute walk to both Downtown Lakewood and Lakewood Park. Large balcony. Hookups for washer and dryer in basement. Short term lease with opportunity for extension. First month\'s rent and deposit due upon signing of lease.',41.4902,-81.8058,oh
7029945333,https://cleveland.craigslist.org/apa/d/euclid-2-bedroom-15-bathroom-suite-on/7029945333.html,cleveland,https://cleveland.craigslist.org,859,apartment,1000,2,1.5,0,0,1,0,0,0,'laundry in bldg','off-street parking',yes,'At GreenRidge on Euclid we go out of our way to make you feel at home by encouraging you to showcase your individuality, Choose from six different 1 and 2 bedroom floor plans and personalize your apartment with your choice of vertical blind accents, accent paint colors, and carpet colors! Greenridge on Euclid can be found on Euclid Avenue with access to Route 2, I-90 & I-271. Located just a few minutes from downtown Cleveland and the shopping and dining areas of Cleveland\'s East Side. Contact us via phone about apartment 2b today! Call Paul at show contact info . Available Monday - Friday 8:00 am - 5:00 pm and Saturday by Appointment. All apartments feature eight inches of solid concrete between each suite these apartments are built to keep sounds at home, spacious closets with full length mirrored doors and most have both dining rooms and eat-in kitchens. Luxurious wall to wall carpeting complements the living, dining and bedrooms while the kitchens & bathrooms are furnished with ceramic or no wax floors. Standard equipment for the kitchens includes a gas range with a sealed cooktop and self-cleaning oven, energy saving two door frost free refrigerator/freezer, energy star dishwasher, garbage disposal, range hood exhaust fan, and a stainless steel sink with extendable spout faucet. Wood cabinets with easy clean butcher block counter tops and a pantry complete the kitchen. It all adds up to the smart alternative to downtown living, the apartment you deserve and a lifestyle you can afford! At Greenridge on Euclid you\'ll enjoy: ,Bigger Suites,Environmentally friendly LED light fixtures,Free Heat & All Utilities (except electricity, phone & cable),Every room has at least one power outlet with a built in USB charger.,Individual Control of Heat & A/C by Programmable Thermostats,On-site Health Club & Free Wi-Fi* (coming soon),In-suite thermostat to control heat and central air conditioning,Emergency Maintenance 24/7,Bright, Clean Laundry Room open 24/7,Package Delivery Acceptance,Smoke-Free Common Areas,An Intercom System that Connects Visitors to Your Cell Phone,24/7 Interior and Exterior Video Surveillance http://www.greenridgeoneuclid.com https://www.facebook.com/Greenridge-on-Euclid-533365966869525/ https://twitter.com/GreenridgeEuc',41.6025,-81.5258,oh

比较两者时,您将看到 Weka 对文本单元格使用单引号,并使用反斜杠转义文本单元格内的单引号。

我的建议是不要使用 Weka CSVLoader,而是使用 Common CSV Weka 包中的那个。后者比 Weka 更好地处理常见的 CSV 方言。

© www.soinside.com 2019 - 2024. All rights reserved.