C# Class CFGLib.CNFGrammar

Represents a concrete (probabilistic) context free grammar in Chomsky normal form (CNF)
Inheritance: BaseGrammar
Show file Open project: ellisonch/CFGLib Class Usage Examples

Private Properties

Property Type Description
BuildLookups void
CNFGrammar System
ProductionsFrom IEnumerable
ProductionsProductingTerminal ICollection

Public Methods

Method Description
Accepts ( Sentence s ) : bool

Returns whether this grammar accepts the given sentence

AddProduction ( Production production ) : void
CNFGrammar ( IEnumerable productions, Nonterminal start ) : System
Cyk ( Sentence s ) : double
ShallowClone ( ) : BaseGrammar

Protected Methods

Method Description
RemoveProductionWithoutSimplifying ( Production production ) : void

Private Methods

Method Description
BuildLookups ( ) : void
CNFGrammar ( ) : System
ProductionsFrom ( Nonterminal lhs ) : IEnumerable
ProductionsProductingTerminal ( Terminal terminal ) : ICollection

Method Details

Accepts() public method

Returns whether this grammar accepts the given sentence
public Accepts ( Sentence s ) : bool
s Sentence
return bool

AddProduction() public method

public AddProduction ( Production production ) : void
production Production
return void

CNFGrammar() public method

public CNFGrammar ( IEnumerable productions, Nonterminal start ) : System
productions IEnumerable
start Nonterminal
return System

Cyk() public method

public Cyk ( Sentence s ) : double
s Sentence
return double

RemoveProductionWithoutSimplifying() protected method

protected RemoveProductionWithoutSimplifying ( Production production ) : void
production Production
return void

ShallowClone() public method

public ShallowClone ( ) : BaseGrammar
return BaseGrammar