CSVLoader : Suggestion to update

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CSVLoader : Suggestion to update

Desai Ankit
Hello People,

Following is the code improvement suggestion in weka's CSVLoader.

If the csv input is as follow:

"abc,xyz.",pqr,ab,5.11,5.0,0,0,abc,0,1,14
or 
'abc,xyz.',pqr,ab,5.11,5.0,0,0,abc,0,1,14

It is able to escape the quotes (' or ") but the loaded csv data is malformed. 

I suggest following regex should be applied to over come this problem. 

newCsvLine = csvLine.replaceAll("(\"[^\",]+),([^\"]*\")", "$1$2").replaceAll("(\'[^\',]+),([^\']*\')", "$1$2")

Kindly accommodate the suggestion if its feasible. 


_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html