cooklang-import 0.3.3

A tool for importing recipes into Cooklang format
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::model::Recipe;
use scraper::Html;

mod json_ld;
mod plain_text_llm;

pub use self::json_ld::JsonLdExtractor;
pub use self::plain_text_llm::PlainTextLlmExtractor;

pub struct ParsingContext {
    pub url: String,
    pub document: Html,
    pub texts: Option<String>,
}

pub trait Extractor {
    fn parse(&self, context: &ParsingContext) -> Result<Recipe, Box<dyn std::error::Error>>;
}