Akron | 2e211f6 | 2022-03-01 15:18:36 +0100 | [diff] [blame^] | 1 | use std::env; |
| 2 | use std::fs; |
| 3 | |
| 4 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 5 | let splitter = |
| 6 | nnsplit::NNSplit::load("de", nnsplit::NNSplitOptions::default())?; |
| 7 | |
| 8 | let args: Vec<String> = env::args().collect(); |
| 9 | let filename = &args[1]; |
| 10 | |
| 11 | let contents = fs::read_to_string(filename) |
| 12 | .expect("Something went wrong reading the file"); |
| 13 | |
| 14 | let input: Vec<&str> = vec![&contents]; |
| 15 | let splits = &splitter.split(&input)[0]; |
| 16 | |
| 17 | for sentence in splits.iter() { |
| 18 | println!("{}", sentence.text()); |
| 19 | } |
| 20 | |
| 21 | Ok(()) |
| 22 | } |