Skip to content

Commit

Permalink
Fix missing header in CSV transform
Browse files Browse the repository at this point in the history
  • Loading branch information
soaxelbrooke committed May 28, 2019
1 parent fb79eb8 commit c4bb43c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "phrase"
version = "0.3.4"
version = "0.3.5"
description = "Fast significant term and phrase learning and labeling"
authors = ["Stuart Axelbrooke <[email protected]>"]
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Download and extract the [release archive](https://github.com/soaxelbrooke/phras
For example, installing the linux binary:

```
$ wget https://github.com/soaxelbrooke/phrase/releases/download/0.3.4/phrase-0.3.4-x86_64-unknown-linux-gnu.tar.gz
$ tar -xzvf phrase-0.3.4-x86_64-unknown-linux-gnu.tar.gz
$ wget https://github.com/soaxelbrooke/phrase/releases/download/0.3.5/phrase-0.3.5-x86_64-unknown-linux-gnu.tar.gz
$ tar -xzvf phrase-0.3.5-x86_64-unknown-linux-gnu.tar.gz
$ sudo mv phrase /usr/local/bin/
```

Expand Down
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,8 @@ fn transform_inner(inbuf: &mut Input, outbuf: &mut Output, mode: ParseMode, deli
fn transform_csv(inbuf: &mut std::io::Read, outbuf: &mut std::io::Write, delim: String, text_fields: &Vec<String>, label_fields: &Vec<String>) {
let mut reader = csv::Reader::from_reader(inbuf);
let mut writer = csv::Writer::from_writer(outbuf);
writer.write_record(reader.headers().expect("Couldn't read header of input file"))
.expect("Couldn't write header");
let text_idxs: Vec<usize> = header_indexes(&mut reader, text_fields);
let label_idxs: Vec<usize> = header_indexes(&mut reader, label_fields);
for record in reader.records() {
Expand Down Expand Up @@ -1342,7 +1344,7 @@ fn normalize_label(label: &Option<String>) -> Option<String> {

fn main() {
let matches = clap_app!(phrase =>
(version: "0.3.4")
(version: "0.3.5")
(author: "Stuart Axelbrooke <[email protected]>")
(about: "Detect phrases in free text data.")
(setting: clap::AppSettings::ArgRequiredElseHelp)
Expand Down

0 comments on commit c4bb43c

Please sign in to comment.