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.
Questions tagged [cyk]
37 questions
2
votes
0 answers
Python - How to implement Deterministic CYK algorithm without NLTK
NOTE: For this question I cannot use any imports other than io and sys
For an NLP assignment, I have to create a program that takes a grammar file and an utterance file as system arguments, which I've done.
The problem is, I'm so confused as to how…

Curtis White
- 250
- 3
- 13
2
votes
2 answers
Is this CYK parser result correct?
I am trying to learn the CYK parsing algorithm.
For this set of grammar rules, are the resulting tables correct for the two given sentences?
S -> NP VP
VP -> VB NP
NP -> DT NN
PP -> IN NP
NP -> NP PP
NP -> NN
VP -> VP PP
IN -> with
NN -> dog
NN ->…

Eric
- 1,093
- 1
- 9
- 21
1
vote
0 answers
CYK algorithm top down design with memoization
I run the CYK algorithm, however, I am trying to do it as a top down design (memoization), any help?
bool canDerive(nonterminal S, string w) {
return canDeriveRec(S, w, 0, w.size());
}
/* Can you derive the substring [start, end) of w from S?…

SMH
- 1,276
- 3
- 20
- 40
1
vote
1 answer
Extra branches being added to tree when generated
I've implemented the CYK parsing algorithm which uses a bottoms-up approach to build a parse tree. As it traverses the algorithm, the path to the ultimate solution is stored in backpointers. From the backpointers, we construct the tree. This final…

mmera
- 327
- 5
- 17
1
vote
1 answer
What is the difference between Viterbi CYK and Probabilistic CYK algorithm, Is there any differences?
I think they are the same concept,
https://courses.engr.illinois.edu/cs498jh/Slides/Lecture10.pdf
Probabilistic CYK algorithm is used the viterbi algorithm to parse, is my concept is correct?

Ayesha Khatun Sujana
- 145
- 2
- 7
1
vote
0 answers
CYK algorithm implementation C++
I've been trying to implement the CYK algorithm based on the pseudocode given by wikipedia, however I can't seem to get it right and I don't know what is wrong with the code. My best guess is that my indexes are wrong, since the pseudocode does not…

Alexis Matuk
- 11
- 3
1
vote
0 answers
Java algorithm to Xsl
I'm working on an implementation of the CYK parsing algorithm for context free grammars.
However the hard part is I'm required to do this in XSL(A functional language) as opposed to a more procedural one that I'm quite familiar with - like Java.
I…

Mike Justice
- 11
- 2
1
vote
1 answer
CYK algorithm implementation java
I'm trying to implement the CYK algorithm based on wikipedia pseudocode. When I test the string "a b" for the grammar input:
S->A B
A->a
B->b
It gives me false, and I think it should be true. I have an arraylist called AllGrammar that contains all…

user2466704
- 23
- 2
- 8
1
vote
1 answer
How to implement epsilon transition?
I am currently trying to implement CYK with epsilon transition. How does the algorithm provided handles epsilon transitions? If not how would you go about to implement it? (I am using Java)

user2253741
- 165
- 6
1
vote
1 answer
simple CFG parser with epsilon transition
I have stumbled upon many different algorithms(CYK and Earley) to check whether or not a string is part of the CFL whose CFG is provided. I am looking for something simple to understand and implement. What I need to know is if the string is in the…

iordanis
- 1,284
- 2
- 15
- 28
0
votes
0 answers
How many prefix of word w lie in Language G in form of GNF? (Theory of computation)
Given contextfree Grammar G = ({S,A,B,C}, Σ, P, S) with Alphabet set of Σ = {a, b} and has following Production rules:
S
→ AA ∣ BA ∣ BB ,
A
→ a ∣ AC ∣ BC ,
B
→ b ∣ CS ,
C
→ b
Question is, how many prefix does word w = bbbaaa in…

viradia
- 35
- 1
- 8
0
votes
0 answers
Cocke Younger Kasami (CYK) algorithm and computer vision
You may have seen the triangular matrix for syntactic analysis. Is there any implementation of the CYK Algorithm using computer vision?

dde
- 650
- 8
- 18
0
votes
0 answers
Probabilistic CYK algorithm for parsing not working
I'm trying to build a parse tree using CYK Algorithm on a Probabilistic CFG . This is my Probabilistic CFG
pcfg = PCFG.fromstring("""S -> NP VP [1.0]
NP -> DT NN [0.5]
NP -> NP PP [0.25]
…

Bharathi
- 201
- 1
- 8
0
votes
1 answer
How to implement CYK parsing algorithm in Ruby?
I am trying to implement CYK algorithm in Ruby according to pseudocode from Wikipedia. My implementation fails to produce the correct parse table. In the method given below, grammar is a member of my own grammar class. Here is the code:
# checks…

Jan Parzydło
- 367
- 4
- 15
0
votes
0 answers
Python list to Parse tree
In Python, I have an input of list like following-
[('S', ['NP', 'VP']),
('A', ['V', 'NP']),
('VP', ['V', 'NP']),
('NP', ['DET', 'NP']),
('N', "'mouse'"),
('NP', "'mouse'"),
('DET', "'the'"),
('V', "'saw'"),
('N', "'Ron'"),
('NP', "'Ron'")]
This is…

Touhidul Alam
- 321
- 2
- 11