NLP Notebook: Languages #586
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a new section for languages in
nlp.ipynb
. I gave a quick overview of context-free grammars and probabilistic cfgs, then I gave an overview of lexicons and grammars and finally gave examples using our implementations.Work on notebook, including an image for tree parsing.
Update
test_nlp.py
; added test forGrammar
.Update
nlp.py
comments.EDIT: I added
generate_random
. Even though most of the generated sentences are pretty much gibberish and can be very long, I think it is interesting to see what kind of phrases a very simplistic grammar can generate.PS: So far in the chapter I have only encountered CFGs (and PCFGs). So even though there are other types of languages, I have refrained from writing on them since the book seems to focus on CFGs. If that is not the case and later on I encounter other grammars, I will amend the relevant section to add the rest of the grammars.