Comments (4)
By default, TAB and newline characters are replaced a space. A different replacement string can be specified using the --r|replacement
option.
These details can be found in the csv2tsv reference, or by using the --help-verbose
option.
from tsv-utils.
But doesn't this change the original data? Tabs and newlines might special means in the original CSV files.
Generally speaking, are there field delimiters and line delimiters that are safe to use in most situations? That is people seldom use them in text and no escape is required for them.
from tsv-utils.
TSV file format uses TABs and newlines as delimiters precisely because these characters are not part of the data in the vast majority of large data sets. It's certainly true of most data mining scenarios. The reason csv2tsv
defaults to spaces as the replacement character is that it tends to be a reasonable choice when working with NLP data sets.
Of course, TAB and newline may carry meaning in some data sets. Most software tools support alternate field delimiters, so something other than TAB can be chosen. Very few tools support alternate record (line) delimiters. If newlines need to be preserved in the data set being used, then it's better to use a file format that supports full character escaping.
Using TSV is a tradeoff. The lack of escapes results in much simpler and less error prone processing, and can run faster as well. However, it is not the best format for every use case.
To your more general question: ASCII does define control characters intended for these purposes, CTRL-~ and CTRL-_ (decimal 30 and 31, Hex 1E and 1F) for record separator and field separator. However, these never got much support. However, you use one of these in place of TAB for field delimiter.
There is related discussion in the Comparing TSV and CSV formats page in this repository.
The wikipedia article on Tab-separated values has more info on TSV file format.
Update: In Release 2.1.0 csv2tsv
supports options to specify separate replacement strings for TABs and newlines found in CSV data fields. This allows selection of characters that can used to preserve the meaning of TAB and newline characters. There are several unicode characters that can be used for this purpose, including U+2028 (Line Separator), U+2029 (Paragraph Separator), U+2424 (, Visual Newline), U+2409 (␉, Visual TAB). Whether this is approach is applicable depends on the specific task. See PR #303 for details.
from tsv-utils.
Been 13 days, assuming the answer is sufficient and closing. Please add addition comments if further discussion would benefit.
from tsv-utils.
Related Issues (20)
- AUR package with LTO & PGO enabled HOT 2
- How to best use the code as a library? HOT 4
- Improve tsv-pretty lookahead logic [tsv-pretty mistake in column formatting.] HOT 8
- bufferedByLine does not work with File due to @safe <> @system conflict HOT 3
- Issue with installing on Windows 10 using D / build failure HOT 28
- tsv-summarize: Slice SummarizerBase._operators when invoking std.algorithm.each
- Inconsistent newline handling on Windows HOT 2
- Status of Windows build HOT 6
- Bulding tsv-utils with LTO and PGO on Archlinux HOT 14
- Homebrew install HOT 6
- Package tsv-utils for conda(-forge)? HOT 1
- No linux release assets for v2.2.1
- -bash: ./tsv-pretty: cannot execute binary file HOT 1
- Ability to produce proper CSV files
- Sort using column names
- tsv-append: limit number of rows per file? [feature request]
- Error [tsv-filter]: Not enough fields in line. File: c.tsv, Line: 1425063 HOT 1
- ENH: Add ARM64 build assets for native functionality on M1 macs (the future)
- Q: any API doc? how to skip empty field in csvReader?
- Updated benchmarks including qsv
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsv-utils.