Language detection with language boundary recognition