Crates.io | economic_indicator_finder |
lib.rs | economic_indicator_finder |
version | 0.1.1 |
source | src |
created_at | 2023-10-30 16:34:20.084952 |
updated_at | 2023-10-31 17:08:31.638512 |
description | A finder for extracting economic indicators from paragraphs |
homepage | |
repository | https://github.com/seongs1024/economic_indicator_finder |
max_upload_size | |
id | 1018760 |
size | 114,387 |
A finder for extracting economic indicators from paragraphs
use economic_indicator_finder::prelude::*;
use anyhow::Result;
use std::fs::read_to_string;
fn main() -> Result<()> {
let speechs = Speech::from_json_file("speech/speech.json")?;
let finder = Finder::new(Indicator::from_json_file("asset/indicators.json")?)?;
for speech in speechs {
let speaker = &speech.speaker;
let speech = read_to_string(speech.file)?;
let matches: Vec<_> = finder.matches(speech);
println!("From the speech of {}: {:#?}", speaker, matches);
}
Ok(())
}