zeba_books_syllabus_parser 0.0.1
zeba_books_syllabus_parser: ^0.0.1 copied to clipboard
Automates extraction of course schedules and grading data from unstructured syllabi.
example/main.dart
import 'package:zeba_books_syllabus_parser/zeba_books_syllabus_parser.dart';
void main() {
final rawText = """
Course Schedule
Oct 12 - Introduction
Oct 14 - Lecture 2
Grading Policy
Homework 40
Project 60
""";
final scanner = SyllabusScanner(rawText);
final scheduleSection = scanner.extractSection('Course Schedule')!;
final gradingSection = scanner.extractSection('Grading Policy')!;
final schedule = ScheduleExtractor().extractFromText(scheduleSection);
for (var item in schedule) {
print(item.toJson());
}
final gradingItems = gradingSection
.split('\n')
.where((line) => line.trim().isNotEmpty)
.map((line) {
final parts = line.split(RegExp(r'\s+'));
final component = parts.sublist(0, parts.length - 1).join(' ').trim();
final weight = double.tryParse(parts.last.trim()) ?? 0.0;
return GradingItem(component: component, weight: weight);
})
.toList();
final audit = GradingAudit(gradingItems);
print('Total Weight: ${audit.totalWeight()}');
print('Is grading valid? ${audit.isValid()}');
}