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
30#[cfg(all(test, feature = "golden-tests"))]
31mod golden_test;
32
33pub use credits::{detect_credits_authors, is_credits_file};
34pub use types::{AuthorDetection, CopyrightDetection, HolderDetection};
35
36pub fn detect_copyrights(
37 content: &str,
38 max_runtime: Option<Duration>,
39) -> (
40 Vec<CopyrightDetection>,
41 Vec<HolderDetection>,
42 Vec<AuthorDetection>,
43) {
44 if let Some(max_runtime) = max_runtime {
45 detector::detect_copyrights_from_text_with_deadline(content, Some(max_runtime))
46 } else {
47 detector::detect_copyrights_from_text(content)
48 }
49}