I have a simple artificial language. It has about 200 words and it has a grammar. I am trying to figure out how to learn that grammar, which I think is called grammar induction, then print those rules. I have found a few papers specifically about what I want to do but 2 are in Chinese and the other was way over my head because I am new to NLP. I am looking for, if possible, very simple example in that I learn better by reading code than papers. Does anyone have any ideas?

Also I should add my corpus will contain conversations between 2 entities.

  • 3
    What exactly is the output you want? Do you want it to give you, say, a series of CFG rules for the syntax?
    – Draconis
    Mar 4, 2020 at 19:01
  • Anything readable by a human such as if then type rules a state diagram, relationship map. Basically some that says like all sentences start with A except when message Y then sentence starts with b.
    – Robi Sen
    Mar 4, 2020 at 19:25
  • If it has only 200 words, I guess its corpus is extremely small, so I don't think NLP will help you: any decently powerful neural network will simply "memorize" the entire corpus (i.e., its output will be made of fragments you already have in the corpus).
    – jick
    Mar 4, 2020 at 21:31
  • 3
    No, it's not about how complex the state machines can get. It's about the size of corpus. To do anything interesting with NLP, you need large data: for context, the entire work of Shakespeare is frequently used as a toy dataset (just to demonstrate how the algorithm works).
    – jick
    Mar 4, 2020 at 23:12
  • 1
    @jick: I interpreted the first sentence as 'It has about 200 words in the lexicon'. If I understand the question correctly, OP is testing the system using this artificial language with a very small lexicon, and can probably generate as large a corpus as he needs using the underlying artificial language. OP, am I right in my interpretation? Mar 4, 2020 at 23:49

1 Answer 1


Papers With Code probably has precisely what you're looking for. Search for your paper in there. As for libraries, Keras is super simple to get started with. Can get it stand-alone or included in TensorFlow which includes many advanced useful tools.

  • Thank you I am using keras and tensorflow or pytorch. The examples I have see of grammar induction where to complex for me. I need some simpler. I did review papers with code and saw two examples but each is several thousand lines of code and I am not sure they do what I am interested in. That being said I am learning about a topic I have almost no knowledge of so that's food
    – Robi Sen
    Mar 4, 2020 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.