7. The computer-implemented method of claim 1 , wherein determining clusters of the n-gram spans for each of the non-terminal types, comprises: selecting pairs of n-grams spans; determining a similarity measure for each pair of n-gram spans, each similarity measure being a measure of similarity of the n-gram spans in the pair of n-grams spans to each other; and clustering the n-gram spans based on the similarity measures.
8. The computer-implemented method of claim 7 , wherein clustering the n-gram spans based on the similarity measures comprises: iteratively selecting pairs of n-gram spans in an order according to their respective similarity measures until a convergence condition is met; after each iterative selection: determining whether any of the n-gram spans belonging to the pair of n-gram spans belong to a cluster; for each pair of n-gram spans for which none of the n-gram spans of the pair belong to a cluster, creating a cluster the includes the n-gram spans; for each pair of n-gram spans for which only one of the n-gram spans belong to a cluster, adding the other n-gram span of the pair to the cluster; and for each pair of n-gram spans for which one of the n-gram spans belong to a first cluster and the other of the n-gram spans belong to a second cluster, merging the first and second clusters.