Skip to content
Snippets Groups Projects

Resolve "Implement DB Integration"

Merged Phil Höfer requested to merge 35-implement-db-integration into main
4 files
+ 49
2
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -93,12 +93,15 @@ pub fn from_file_path(file_path: &str) -> Result<SetPredictor, std::io::Error> {
let mut reader = ReaderBuilder::new().from_reader(file);
let mut markov_chain: SetPredictor = SetPredictor::new();
let mut count = 0;
for result in reader.records() {
let record = result?;
if let Some(query) = record.get(5) {
markov_chain.update(query);
count += 1;
}
}
println!("{} queries read from file", count);
Ok(markov_chain)
}
@@ -114,12 +117,15 @@ pub fn from_file_path_and_config(file_path: &str, config: HashMap<String, impl I
let mut markov_chain: SetPredictor = SetPredictor::new();
markov_chain.configuration = configuration;
let mut count = 0;
for result in reader.records() {
let record = result?;
if let Some(query) = record.get(5) {
markov_chain.update(query);
count += 1;
}
}
println!("{} queries read from file", count);
Ok(markov_chain)
Loading