MCPcopy Create free account
hub / github.com/daisy/MathCAT / read_patterns

Method read_patterns

src/speech.rs:2072–2085  ·  view source on GitHub ↗
(&mut self, path: &Locations)

Source from the content-addressed store, hash-verified

2070 }
2071
2072 fn read_patterns(&mut self, path: &Locations) -> Result<()> {
2073 if let Some(p) = &path[0] {
2074 // info!("Reading rule file: {}", p.to_str().unwrap());
2075 let rule_file_contents = read_to_string_shim(p.as_path()).expect("cannot read file");
2076
2077 let rules_build_fn = |pattern: &Yaml| {
2078 self.build_speech_patterns(pattern, p)
2079 .chain_err(||format!("in file {:?}", p.to_str().unwrap()))
2080 };
2081 return compile_rule(&rule_file_contents, rules_build_fn)
2082 .chain_err(||format!("in file {:?}", p.to_str().unwrap()));
2083 }
2084 return Ok(());
2085 }
2086
2087 fn build_speech_patterns(&mut self, patterns: &Yaml, file_name: &Path) -> Result<()> {
2088 // Rule::SpeechPatternList

Callers 2

buildMethod · 0.80
read_filesMethod · 0.80

Calls 2

compile_ruleFunction · 0.85
build_speech_patternsMethod · 0.80

Tested by

no test coverage detected