<commit_before>USING: help.syntax help.markup kernel prettyprint sequences
io.pathnames strings ;
IN: csv

HELP: read-row
{ $values { "stream" "an input stream" }
          { "row" "an array of fields" } }
{ $description "parses a row from a csv stream" } ;

HELP: read-csv
{ $values { "stream" "an input stream" }
          { "rows" "an array of arrays of fields" } }
{ $description "Parses a csv stream into an array of row arrays." } ;

HELP: file>csv
{ $values
    { "path" pathname } { "encoding" "an encoding descriptor" }
    { "csv" "csv" }
}
{ $description "Opens a file and parses it into a sequence of comma-separated-value fields." } ;

HELP: csv>file
{ $values
    { "rows" "a sequence of sequences of strings" }
    { "path" pathname } { "encoding" "an encoding descriptor" }
}
{ $description "Writes a comma-separated-value structure to a file." } ;

HELP: string>csv
{ $values
    { "string" string }
    { "csv" "csv" }
}
{ $description "Parses a string into a sequence of comma-separated-value fields." } ;

HELP: csv>string
{ $values
    { "csv" "csv" }
    { "string" string }
}
{ $description "Writes a comma-separated-value structure to a string." } ;

HELP: write-row
{ $values { "row" "an array of fields" } }
{ $description "writes a row to the output stream" } ;

HELP: write-csv
{ $values { "rows" "a sequence of sequences of strings" }
          { "stream" "an output stream" } }
{ $description "Writes a sequence of sequences of comma-separated-values to the output stream, escaping where necessary." } ;

HELP: with-delimiter
{ $values { "ch" "field delimiter (e.g. CHAR: \\t)" }
          { "quot" "a quotation" } }
{ $description "Sets the field delimiter for read-csv, read-row, write-csv, or write-row words." } ;

ARTICLE: "csv" "Comma-separated-values parsing and writing"
"The " { $vocab-link "csv" } " vocabulary can read and write CSV (comma-separated-value) files." $nl
"Working with CSV files:"
{ $subsections file>csv csv>file }
"Working with CSV strings:"
{ $subsections string>csv csv>string }
"Changing the delimiter from a comma:"
{ $subsections with-delimiter }
"Reading from a stream:"
{ $subsections read-csv read-row }
"Writing to a stream:"
{ $subsections write-csv write-row } ;

ABOUT: "csv"
<commit_msg>csv: fix help-lint warnings.<commit_after>USING: help.syntax help.markup kernel prettyprint sequences
io.pathnames strings ;
IN: csv

HELP: read-row
{ $values { "row" "an array of fields" } }
{ $description "parses a row from a csv stream" } ;

HELP: read-csv
{ $values { "rows" "an array of arrays of fields" } }
{ $description "Parses a csv stream into an array of row arrays." } ;

HELP: file>csv
{ $values
    { "path" pathname } { "encoding" "an encoding descriptor" }
    { "csv" "csv" }
}
{ $description "Opens a file and parses it into a sequence of comma-separated-value fields." } ;

HELP: csv>file
{ $values
    { "rows" "a sequence of sequences of strings" }
    { "path" pathname } { "encoding" "an encoding descriptor" }
}
{ $description "Writes a comma-separated-value structure to a file." } ;

HELP: string>csv
{ $values
    { "string" string }
    { "csv" "csv" }
}
{ $description "Parses a string into a sequence of comma-separated-value fields." } ;

HELP: csv>string
{ $values
    { "csv" "csv" }
    { "string" string }
}
{ $description "Writes a comma-separated-value structure to a string." } ;

HELP: write-row
{ $values { "row" "an array of fields" } }
{ $description "writes a row to the output stream" } ;

HELP: write-csv
{ $values { "rows" "a sequence of sequences of strings" } }
{ $description "Writes a sequence of sequences of comma-separated-values to the output stream, escaping where necessary." } ;

HELP: with-delimiter
{ $values { "ch" "field delimiter (e.g. CHAR: \\t)" }
          { "quot" "a quotation" } }
{ $description "Sets the field delimiter for read-csv, read-row, write-csv, or write-row words." } ;

ARTICLE: "csv" "Comma-separated-values parsing and writing"
"The " { $vocab-link "csv" } " vocabulary can read and write CSV (comma-separated-value) files." $nl
"Working with CSV files:"
{ $subsections file>csv csv>file }
"Working with CSV strings:"
{ $subsections string>csv csv>string }
"Changing the delimiter from a comma:"
{ $subsections with-delimiter }
"Reading from a stream:"
{ $subsections read-csv read-row }
"Writing to a stream:"
{ $subsections write-csv write-row } ;

ABOUT: "csv"

{'fraction_non_alphanumeric': 0.13825198637911465, 'fraction_numerical': 0.0, 'mean_word_length': 3.7376344086021507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7287343', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1424, 'n_words': 511}