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 refiner::refine_author;
32pub use types::{AuthorDetection, CopyrightDetection, HolderDetection};
33
34pub fn detect_copyrights(
35 content: &str,
36 max_runtime: Option<Duration>,
37) -> (
38 Vec<CopyrightDetection>,
39 Vec<HolderDetection>,
40 Vec<AuthorDetection>,
41) {
42 if let Some(max_runtime) = max_runtime {
43 detector::detect_copyrights_from_text_with_deadline(content, Some(max_runtime))
44 } else {
45 detector::detect_copyrights_from_text(content)
46 }
47}