Context. Reliably predicting solar flares can mitigate the risks of technological damage and enhance scientific output by providing reliable pointings for observational campaigns. Flare precursors in the spectral line Mg II have been identified. Aims. We extend previous studies by examining the presence of flare precursors in additional spectral lines, such as Si IV and C II, over longer time windows, and for more observations. Methods. We trained neural networks and XGBoost decision trees to distinguish spectra observed from active regions that lead to a flare and those that did not. To enhance the information within each observation, we tested different masking methods to preprocess the data. Results. We find average classification true skill statistics (TSS) scores of 0.53 for Mg II, 0.44 for Si IV, and 0.42 for C II. We speculate that Mg II h&k performs best because it samples the highest formation height range, and is sensitive to heating and density changes in the mid- to upper chromosphere. The flaring area relative to the field of view has a large effect on the model classification score and needs to be accounted for. Combining spectral lines has proven difficult, due to the difference in areas of high probability for an imminent flare between different lines. Conclusions. Our models extract information from all three lines, independent of observational bias or GOES X-ray flux precursors, implying that the physics encoded in a combination of high resolution spectral data could be useful for flare forecasting.