provenant/copyright/
mod.rs1use std::time::Duration;
14
15mod candidates;
16mod credits;
17mod detector;
18mod detector_input_normalization;
19pub mod golden_utils;
20mod grammar;
21mod hints;
22mod lexer;
23mod line_tracking;
24mod parser;
25mod patterns;
26mod prepare;
27mod refiner;
28mod types;
29
30pub use credits::{detect_credits_authors, is_credits_file};
31pub(crate) use prepare::prepare_text_line;
32pub(crate) use refiner::has_copyright_year;
33pub(crate) use refiner::looks_like_source_code;
34pub(crate) use refiner::refine_author;
35pub use refiner::refine_copyright;
36pub use types::{AuthorDetection, CopyrightDetection, HolderDetection};
37
38pub fn detect_copyrights(
39 content: &str,
40 max_runtime: Option<Duration>,
41) -> (
42 Vec<CopyrightDetection>,
43 Vec<HolderDetection>,
44 Vec<AuthorDetection>,
45) {
46 if let Some(max_runtime) = max_runtime {
47 detector::detect_copyrights_from_text_with_deadline(content, Some(max_runtime))
48 } else {
49 detector::detect_copyrights_from_text(content)
50 }
51}