use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SemanticType {
Document,
Div,
Paragraph,
Span,
Table,
TableHeaders,
TableFooter,
TableBody,
TableRow,
TableHeader,
TableCell,
Form,
Link,
Annot,
Caption,
List,
ListLabel,
ListBody,
ListItem,
TableOfContent,
TableOfContentItem,
Figure,
NumberHeading,
Heading,
Title,
BlockQuote,
Note,
Header,
Footer,
Code,
Part,
}
impl SemanticType {
pub fn is_ignored_standard_type(&self) -> bool {
matches!(
self,
SemanticType::Div
| SemanticType::Span
| SemanticType::Form
| SemanticType::Link
| SemanticType::Annot
)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum TextAlignment {
Left,
Right,
Center,
Justify,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
pub enum TextFormat {
#[default]
Normal,
Superscript,
Subscript,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
pub enum TextType {
#[default]
Regular,
Large,
Logo,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
pub enum PdfLayer {
#[default]
Main,
Content,
TableCells,
ListItems,
TableContent,
ListContent,
TextBlockContent,
HeaderAndFooterContent,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum TriageDecision {
Local,
Backend,
Both,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_semantic_type_ignored() {
assert!(SemanticType::Div.is_ignored_standard_type());
assert!(SemanticType::Span.is_ignored_standard_type());
assert!(!SemanticType::Paragraph.is_ignored_standard_type());
assert!(!SemanticType::Heading.is_ignored_standard_type());
assert!(!SemanticType::Table.is_ignored_standard_type());
}
#[test]
fn test_text_format_default() {
assert_eq!(TextFormat::default(), TextFormat::Normal);
}
}