provenant/copyright/
mod.rs1use std::time::Duration;
11
12mod candidates;
13mod credits;
14mod detector;
15mod detector_input_normalization;
16pub mod golden_utils;
17mod grammar;
18mod hints;
19mod lexer;
20mod line_tracking;
21mod parser;
22mod patterns;
23mod prepare;
24mod refiner;
25mod types;
26
27#[cfg(all(test, feature = "golden-tests"))]
28mod golden_test;
29
30pub use credits::{detect_credits_authors, is_credits_file};
31pub use types::{AuthorDetection, CopyrightDetection, HolderDetection};
32
33pub fn detect_copyrights(
34 content: &str,
35 max_runtime: Option<Duration>,
36) -> (
37 Vec<CopyrightDetection>,
38 Vec<HolderDetection>,
39 Vec<AuthorDetection>,
40) {
41 if let Some(max_runtime) = max_runtime {
42 detector::detect_copyrights_from_text_with_deadline(content, Some(max_runtime))
43 } else {
44 detector::detect_copyrights_from_text(content)
45 }
46}