Grammatical inference by constructive method