From Pasted Notes to Candidate Facts
sentence splitting
Part of: AI Flashcard Generator
The flashcard generator you're building starts with the messiest input there is. A learner pastes a chunk of notes, a textbook paragraph, or half a lecture transcript, then hits Generate and expects a clean deck. Before any model sees that text, you cut it into small pieces that could each become one card. One card, one fact. A good flashcard tests exactly one idea. "Mitochondria produce ATP and the nucleus stores DNA" is two cards pretending to be one. If you send a whole paragraph to the model and ask for cards, it will happily blend facts together, skip some, and repeat others. If you send it one sentence at a time, each card has a single, traceable source. So the first stage of the pipeline is a segmenter . It takes raw text and returns a list of candidate facts , usually one per sentence. A splitter that is good enough. Full sentence segmentation is a hard problem (abbreviations like "Dr." and "e.g." trip up every simple rule). For study notes, a regular expression that splits after a period, question mark, or exclamation mark followed by whitespace gets you most of the way. Three things happen here. First, " ".join(text.split()) collapses newlines, tabs, and double spaces int
Challenge: Count the Usable Facts