1. A method for processing documents, comprising: obtaining optical character recognition (OCR) results for a document; processing the OCR results using a matching graph to obtain matching results, comprising: generating an observation graph using the OCR results; and determining a best path in the matching graph, the matching graph comprising: an initial state, a final state, at least one matching subgraph node between the initial state and the final state, and a trash state, between the initial state and the final state, wherein the trash state and the at least one matching subgraph node are not directly connected by any edge in the matching graph, wherein determining the best path in the matching graph comprises traversing the matching graph at least once, from the initial state to the final state via the at least one matching subgraph nodes, using observation nodes in the observation graph; and providing the matching results to a user computing system.