ext/linkage.c
void
rlink_init_linkage(void)
{
#ifdef FOR_RDOC
	rlink_mLinkParser = rb_define_module( "LinkParser" );
	rlink_eLpError = rb_define_class_under( rlink_mLinkParser, "Error", rb_eRuntimeError );
#endif

	rlink_cLinkage = rb_define_class_under( rlink_mLinkParser, "Linkage", rb_cObject );
	
	rb_define_alloc_func( rlink_cLinkage, rlink_linkage_s_alloc );
	
	rb_define_method( rlink_cLinkage, "initialize", rlink_linkage_init, -1 );
	rb_define_method( rlink_cLinkage, "diagram", rlink_linkage_diagram, 0 );
	rb_define_method( rlink_cLinkage, "postscript_diagram",
	 	rlink_linkage_print_postscript, 1 );
	rb_define_method( rlink_cLinkage, "links_and_domains", 
		rlink_linkage_links_and_domains, 0 );

	rb_define_method( rlink_cLinkage, "num_sublinkages", 
		rlink_linkage_num_sublinkages, 0 );
	rb_define_method( rlink_cLinkage, "current_sublinkage=",
		rlink_linkage_current_sublinkage_eq, 1 );
	rb_define_method( rlink_cLinkage, "current_sublinkage",
		rlink_linkage_current_sublinkage, 0 );
	
	rb_define_method( rlink_cLinkage, "num_words",
	 	rlink_linkage_get_num_words, 0 );
	rb_define_alias ( rlink_cLinkage, "word_count", "num_words" );
	rb_define_method( rlink_cLinkage, "num_links",
	 	rlink_linkage_get_num_links, 0 );
	rb_define_alias ( rlink_cLinkage, "link_count", "num_links" );
	
	rb_define_method( rlink_cLinkage, "link_lword",
	 	rlink_linkage_get_link_lword, 1 );
	rb_define_method( rlink_cLinkage, "link_rword",
	 	rlink_linkage_get_link_rword, 1 );
	rb_define_method( rlink_cLinkage, "link_length",
	 	rlink_linkage_get_link_length, 1 );
	rb_define_method( rlink_cLinkage, "link_label",
	 	rlink_linkage_get_link_label, 1 );
	rb_define_method( rlink_cLinkage, "link_llabel",
	 	rlink_linkage_get_link_llabel, 1 );
	rb_define_method( rlink_cLinkage, "link_rlabel",
	 	rlink_linkage_get_link_rlabel, 1 );

	rb_define_method( rlink_cLinkage, "link_num_domains",
	 	rlink_linkage_get_link_num_domains, 1 );
	rb_define_method( rlink_cLinkage, "link_domain_names",
	 	rlink_linkage_get_link_domain_names, 1 );
	
	rb_define_method( rlink_cLinkage, "words",
	 	rlink_linkage_get_words, 0 );

	rb_define_method( rlink_cLinkage, "compute_union",
	 	rlink_linkage_compute_union, 0 );
	rb_define_method( rlink_cLinkage, "unused_word_cost",
	 	rlink_linkage_unused_word_cost, 0 );
	rb_define_method( rlink_cLinkage, "disjunct_cost",
	 	rlink_linkage_disjunct_cost, 0 );
	rb_define_method( rlink_cLinkage, "and_cost",
	 	rlink_linkage_and_cost, 0 );
	rb_define_method( rlink_cLinkage, "link_cost",
	 	rlink_linkage_link_cost, 0 );
	rb_define_method( rlink_cLinkage, "canonical?",
	 	rlink_linkage_canonical_p, 0 );
	rb_define_method( rlink_cLinkage, "improper?",
	 	rlink_linkage_improper_p, 0 );
	rb_define_method( rlink_cLinkage, "has_inconsistent_domains?",
	 	rlink_linkage_has_inconsistent_domains_p, 0 );
	rb_define_method( rlink_cLinkage, "violation_name",
	 	rlink_linkage_get_violation_name, 0 );

	/* Struct that contains links of a constituent tree */
	rb_define_const( rlink_cLinkage, "CTree", rlink_sLinkageCTree );

	rlink_sLinkageCTree = rb_struct_define( "LinkParserLinkageCTree", 
		"label", "children", "start", "end", NULL );
	rb_define_method( rlink_cLinkage, "constituent_tree",
		rlink_linkage_constituent_tree, 0 );
	rb_define_method( rlink_cLinkage, "constituent_tree_string",
	 	rlink_linkage_constituent_tree_string, -1 );
}
/* 
 * This is the API's representation of a parse. A LinkParser::Sentence may have one or more
 * of LinkParser::Linkages, each of which represents one possible structure of the sentence.
 * It can be thought of as a Sentence together with a collection of links. If the parse 
 * has a conjunction, then the Linkage is made up of at least two "sublinkages". A 
 * Linkage can be pretty printed in either ASCII or Postscript format, and individual 
 * links can be extracted.
 *
 */
This is the API's representation of a parse. A LinkParser::Sentence may have one or more
of LinkParser::Linkages, each of which represents one possible structure of the sentence.
It can be thought of as a Sentence together with a collection of links. If the parse
has a conjunction, then the Linkage is made up of at least two "sublinkages". A
Linkage can be pretty printed in either ASCII or Postscript format, and individual
links can be extracted.
This is the API ' s representation of a parse . A LinkParser :: Sentence may have one or more of LinkParser :: Linkages each of which represents one possible structure of the sentence . It can be thought of as a Sentence together with a collection of links . If the parse has a conjunction then the Linkage is made up of at least two " sublinkages " . A Linkage can be pretty printed in either ASCII or Postscript format and individual links can be extracted .
void
rlink_init_linkage(void)
{
#ifdef FOR_RDOC
	rlink_mLinkParser = rb_define_module( "LinkParser" );
	rlink_eLpError = rb_define_class_under( rlink_mLinkParser, "Error", rb_eRuntimeError );
#endif
	rlink_cLinkage = rb_define_class_under( rlink_mLinkParser, "Linkage", rb_cObject );
	rb_define_alloc_func( rlink_cLinkage, rlink_linkage_s_alloc );
	rb_define_method( rlink_cLinkage, "initialize", rlink_linkage_init, -1 );
	rb_define_method( rlink_cLinkage, "diagram", rlink_linkage_diagram, 0 );
	rb_define_method( rlink_cLinkage, "postscript_diagram",
	 	rlink_linkage_print_postscript, 1 );
	rb_define_method( rlink_cLinkage, "links_and_domains", 
		rlink_linkage_links_and_domains, 0 );
	rb_define_method( rlink_cLinkage, "num_sublinkages", 
		rlink_linkage_num_sublinkages, 0 );
	rb_define_method( rlink_cLinkage, "current_sublinkage=",
		rlink_linkage_current_sublinkage_eq, 1 );
	rb_define_method( rlink_cLinkage, "current_sublinkage",
		rlink_linkage_current_sublinkage, 0 );
	rb_define_method( rlink_cLinkage, "num_words",
	 	rlink_linkage_get_num_words, 0 );
	rb_define_alias ( rlink_cLinkage, "word_count", "num_words" );
	rb_define_method( rlink_cLinkage, "num_links",
	 	rlink_linkage_get_num_links, 0 );
	rb_define_alias ( rlink_cLinkage, "link_count", "num_links" );
	rb_define_method( rlink_cLinkage, "link_lword",
	 	rlink_linkage_get_link_lword, 1 );
	rb_define_method( rlink_cLinkage, "link_rword",
	 	rlink_linkage_get_link_rword, 1 );
	rb_define_method( rlink_cLinkage, "link_length",
	 	rlink_linkage_get_link_length, 1 );
	rb_define_method( rlink_cLinkage, "link_label",
	 	rlink_linkage_get_link_label, 1 );
	rb_define_method( rlink_cLinkage, "link_llabel",
	 	rlink_linkage_get_link_llabel, 1 );
	rb_define_method( rlink_cLinkage, "link_rlabel",
	 	rlink_linkage_get_link_rlabel, 1 );
	rb_define_method( rlink_cLinkage, "link_num_domains",
	 	rlink_linkage_get_link_num_domains, 1 );
	rb_define_method( rlink_cLinkage, "link_domain_names",
	 	rlink_linkage_get_link_domain_names, 1 );
	rb_define_method( rlink_cLinkage, "words",
	 	rlink_linkage_get_words, 0 );
	rb_define_method( rlink_cLinkage, "compute_union",
	 	rlink_linkage_compute_union, 0 );
	rb_define_method( rlink_cLinkage, "unused_word_cost",
	 	rlink_linkage_unused_word_cost, 0 );
	rb_define_method( rlink_cLinkage, "disjunct_cost",
	 	rlink_linkage_disjunct_cost, 0 );
	rb_define_method( rlink_cLinkage, "and_cost",
	 	rlink_linkage_and_cost, 0 );
	rb_define_method( rlink_cLinkage, "link_cost",
	 	rlink_linkage_link_cost, 0 );
	rb_define_method( rlink_cLinkage, "canonical?",
	 	rlink_linkage_canonical_p, 0 );
	rb_define_method( rlink_cLinkage, "improper?",
	 	rlink_linkage_improper_p, 0 );
	rb_define_method( rlink_cLinkage, "has_inconsistent_domains?",
	 	rlink_linkage_has_inconsistent_domains_p, 0 );
	rb_define_method( rlink_cLinkage, "violation_name",
	 	rlink_linkage_get_violation_name, 0 );
	rb_define_const( rlink_cLinkage, "CTree", rlink_sLinkageCTree );
	rlink_sLinkageCTree = rb_struct_define( "LinkParserLinkageCTree", 
		"label", "children", "start", "end", NULL );
	rb_define_method( rlink_cLinkage, "constituent_tree",
		rlink_linkage_constituent_tree, 0 );
	rb_define_method( rlink_cLinkage, "constituent_tree_string",
	 	rlink_linkage_constituent_tree_string, -1 );
}
void rlink_init_linkage ( void ) { #ifdef FOR_RDOC rlink_mLinkParser = rb_define_module ( " " ) ; rlink_eLpError = rb_define_class_under ( rlink_mLinkParser , " " , rb_eRuntimeError ) ; #endif rlink_cLinkage = rb_define_class_under ( rlink_mLinkParser , " " , rb_cObject ) ; rb_define_alloc_func ( rlink_cLinkage , rlink_linkage_s_alloc ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_init , -1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_diagram , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_print_postscript , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_links_and_domains , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_num_sublinkages , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_current_sublinkage_eq , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_current_sublinkage , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_num_words , 0 ) ; rb_define_alias ( rlink_cLinkage , " " , " " ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_num_links , 0 ) ; rb_define_alias ( rlink_cLinkage , " " , " " ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_link_lword , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_link_rword , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_link_length , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_link_label , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_link_llabel , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_link_rlabel , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_link_num_domains , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_link_domain_names , 1 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_words , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_compute_union , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_unused_word_cost , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_disjunct_cost , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_and_cost , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_link_cost , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_canonical_p , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_improper_p , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_has_inconsistent_domains_p , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_get_violation_name , 0 ) ; rb_define_const ( rlink_cLinkage , " " , rlink_sLinkageCTree ) ; rlink_sLinkageCTree = rb_struct_define ( " " , " " , " " , " " , " " , NULL ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_constituent_tree , 0 ) ; rb_define_method ( rlink_cLinkage , " " , rlink_linkage_constituent_tree_string , -1 ) ; }
This is the API's representation of a parse.
This is the API ' s representation of a parse .
/* Struct that contains links of a constituent tree */