1. A computer-implemented method comprising: receiving text; detecting a first segment of the text, where a substantial amount of the first segment represents a first language; detecting a second segment of the text, where a substantial amount of the second segment represents a second language; identifying scores for each n-gram of size x included in the text; and detecting an edge that identifies a transition from the first language to the second language in the text based on variations of the scores.