Skip to content

Small Python script for checking if a word is part of CFG (Context-free Grammar) or not. This script is implementing CYK (Cocke–Younger–Kasami) algorithm.

License

Notifications You must be signed in to change notification settings

theodoregold/cyk-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

What is this?

Small Python script for checking if a word is part of CFG (Context-free Grammar) or not. This script is implementing CYK (Cocke–Younger–Kasami) algorithm.

At the time, I couldn't find any simple/understandable implementation of CYK algorithm that I liked. If you have any questions feel free to create an issue.

Note: Your language must be in Chomsky form.

Getting started

It's really straight forward. Change productions and start_symbol variables to your specific case. Then, just run it. Enter any word and see if it is part of the grammer.

TO-DO

  • include grammer from seperate JSON file in runtime
  • convert any CFG to Chomsky form
  • add some checks

Issues

Found a bug or better solution? Please report to the issue section.

About

Small Python script for checking if a word is part of CFG (Context-free Grammar) or not. This script is implementing CYK (Cocke–Younger–Kasami) algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages