Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guessing wrong delimiter #804

Closed
Klingseis opened this issue Jun 19, 2020 · 3 comments
Closed

Guessing wrong delimiter #804

Klingseis opened this issue Jun 19, 2020 · 3 comments

Comments

@Klingseis
Copy link

Klingseis commented Jun 19, 2020

In #687 there was new guessing of right delimiter added. Right now I'm facing the issue, that it predicts "," (Comma) instead of ";" (semicolon).

The reason for this seems to be the final checking if the previewed delimiter is better or not:
if ((typeof bestDelta === 'undefined' || delta <= bestDelta) && (typeof maxFieldCount === 'undefined' || avgFieldCount > maxFieldCount) && avgFieldCount > 1.99)

The delta for semicolon (0) is smaller than bestDelta (5) but the avgFieldCount equals maxFieldCount. For me this looks like you could assume that this delimiter is better, couldn't you?
Maybe I am wrong, but wouldn't it be better to compare avgFieldCount >= maxFieldCount if the delta is smaller?

testGeometries.txt: File to reproduce similar issue.

One correction from my side: My thought above of comparing avgFieldCount >= maxFieldCount if delta is smaller doesn't work.
In attached file delimiter is semicolon, papaparse guesses comma:

comma delta: 4, comma avgFieldCount: 4.6
semicolon delta: 0, semicolon avgFieldCount: 3

Klingseis pushed a commit to Klingseis/PapaParse that referenced this issue Jun 21, 2020
Klingseis pushed a commit to Klingseis/PapaParse that referenced this issue Jun 21, 2020
Klingseis pushed a commit to Klingseis/PapaParse that referenced this issue Jun 21, 2020
…Add test case for checking modification in guessDelimiter (mholt#804)"

This reverts commit ebfee11.
Klingseis pushed a commit to Klingseis/PapaParse that referenced this issue Jun 21, 2020
@Githamza
Copy link

I have the same issue, any solution ?

@Klingseis
Copy link
Author

I use PapaParse together with GUI. If a parsing error occurs or the result is only one column, a fieldset will be displayed to the user where he can type in a delimiter by his own and parse the file again.

@Klingseis
Copy link
Author

Will close this one. Only solution right now is to set the delimiter directly instead of guessing it by PapaParse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants