Questions tagged [cyk]

The CYK algorithm is an efficient algorithm for determining whether a string is in the language generated by a context-free grammar. It uses dynamic programming and is fastest when the input grammar is in Chomsky normal form.

37 questions
0
votes
1 answer

Extract probabilities and most likely parse tree from cyk

In order to understand cyk algorithm I've worked through example on : https://www.youtube.com/watch?v=VTH1k-xiswM&feature=youtu.be . The result of which is : How do I extract the probabilities associated with each parse and extract the most…
blue-sky
  • 51,962
  • 152
  • 427
  • 752
0
votes
2 answers

How to produce products on the CYK table in prolog?

We are using the concept of CYK table formation to produce these results on Prolog. Here are some sample outputs for product_c(+Cell1, +Cell2, -Product): ?- product_c(["A","B"],["C","D"],What). What = ["AC", "AD", "BC", "BD"]. ?-…
0
votes
0 answers

Bottleneck in my recursive python code

I wrote the below code using recursion to do CYK algorithm so that the Grammar G can generate any words having same number of a's followed by any number of b's but for some reason it is very slow, not sure why? When I use s2 it works, but if I used…
Tak
  • 3,536
  • 11
  • 51
  • 93
0
votes
0 answers

How do I apply CYK or any other parsing algorithm without modifying my grammar?

So I have a grammar inside a one-dimensional array, given by the form struct array { char left; char right[3]; char number; } Example: array.left = 'A'; array.right = "BC"; array.number =…
0
votes
1 answer

How to check if a string is obtainable using certain rules?

It's been 1 week since I started trying to find a solution to this problem, and I ended up reading about CYK algorithm, but I can't understand how it would help me. So I have a certain string from which I start, let's call it startString. And I have…
0
votes
2 answers

Python - Finding word on same line as given input

For a method I'm creating, I want to take in a word that is found on the end of a line, and I then want to append the word found to the left of it (at the start of the line up to a space character) to an array. Here is my code so far: def…
Curtis White
  • 250
  • 3
  • 13
0
votes
0 answers

CYK does not give the expected answer

I have implemented the CYK algorithm to check an input string with the given grammar. And if I have the following grammar S->AB|BC A->BA|a B->CC|b C->AB|a and if I check the string ab , the algorithm says it's in grammar. But if I have a grammar…
dnWick
  • 393
  • 3
  • 14
1 2
3