示例#1
0
    def __init__(self, linkage_swig_obj, null_count=0):

        # XXX FIXME Most of the initialization below just wastes CPU time,
        # especially if the user does not need this stuff.
        self.num_of_words = clg.linkage_get_num_words(linkage_swig_obj)
        self.num_of_links = clg.linkage_get_num_links(linkage_swig_obj)
        self.link_cost = clg.linkage_link_cost(linkage_swig_obj)

        self.words = [
            clg.linkage_get_word(linkage_swig_obj, i)
            for i in range(self.num_of_words)
        ]
        self.links = [
            Link(self.words[clg.linkage_get_link_lword(linkage_swig_obj, i)],
                 clg.linkage_get_link_llabel(linkage_swig_obj, i),
                 clg.linkage_get_link_rlabel(linkage_swig_obj, i),
                 self.words[clg.linkage_get_link_rword(linkage_swig_obj, i)])
            for i in range(self.num_of_links)
        ]
        self.null_count = null_count
        self.link_distances = [
            clg.linkage_get_link_length(linkage_swig_obj, i)
            for i in range(self.num_of_links)
        ]

        # XXX FIXME: doing the below, if not needed, is a bit of a cpu-waster!
        #
        # display_walls=0, screen_width=180
        self.diagram = clg.linkage_print_diagram(linkage_swig_obj, 0, 180)
        self.senses = clg.linkage_print_senses(linkage_swig_obj)
        self.links_and_domains = clg.linkage_print_links_and_domains(
            linkage_swig_obj)
示例#2
0
    def __init__(self, linkage_swig_obj, calculate_sub_linkages=True, null_count=0):

        # XXX FIXME Most of the initialization below just wastes CPU time,
        # especially if the user does not need this stuff.
        self.num_of_words = clg.linkage_get_num_words(linkage_swig_obj)
        self.num_of_links = clg.linkage_get_num_links(linkage_swig_obj)
        self.link_cost = clg.linkage_link_cost(linkage_swig_obj)

        self.words = [clg.linkage_get_word(linkage_swig_obj,i) for i in range(self.num_of_words)]
        self.links = [Link(self.words[clg.linkage_get_link_lword(linkage_swig_obj,i)],
                           clg.linkage_get_link_llabel(linkage_swig_obj,i),
                           clg.linkage_get_link_rlabel(linkage_swig_obj,i),
                           self.words[clg.linkage_get_link_rword(linkage_swig_obj,i)]) for i in range(self.num_of_links)]
        self.null_count = null_count
        self.link_distances = [clg.linkage_get_link_length(linkage_swig_obj, i) for i in range(self.num_of_links)]

        # XXX FIXME: doing the below, if not needed, is a bit of a cpu-waster!
        #
        # display_walls=0, screen_width=180
        self.diagram = clg.linkage_print_diagram(linkage_swig_obj, False, 180)

        self.senses = clg.linkage_print_senses(linkage_swig_obj)
        self.links_and_domains = clg.linkage_print_links_and_domains(linkage_swig_obj)
        # Disable postscript. Lets be real, no one will use this.
        # self.postscript_snippet = clg.linkage_print_postscript(linkage_swig_obj, 1, 0)
        # self.postscript = clg.linkage_print_postscript(linkage_swig_obj, 1, 1)
        self.constituent_phrases_nested = clg.linkage_print_constituent_tree(linkage_swig_obj, 1)
示例#3
0
    def __init__(self, linkage_swig_obj, null_count=0):

        # XXX FIXME Most of the initialization below just wastes CPU time,
        # especially if the user does not need this stuff.
        self.num_of_words = clg.linkage_get_num_words(linkage_swig_obj)
        self.num_of_links = clg.linkage_get_num_links(linkage_swig_obj)
        self.link_cost = clg.linkage_link_cost(linkage_swig_obj)

        self.words = [clg.linkage_get_word(linkage_swig_obj,i) for i in range(self.num_of_words)]
        self.links = [Link(self.words[clg.linkage_get_link_lword(linkage_swig_obj,i)],
                           clg.linkage_get_link_llabel(linkage_swig_obj,i),
                           clg.linkage_get_link_rlabel(linkage_swig_obj,i),
                           self.words[clg.linkage_get_link_rword(linkage_swig_obj,i)]) for i in range(self.num_of_links)]
        self.null_count = null_count
        self.link_distances = [clg.linkage_get_link_length(linkage_swig_obj, i) for i in range(self.num_of_links)]

        # XXX FIXME: doing the below, if not needed, is a bit of a cpu-waster!
        #
        # display_walls=0, screen_width=180
        self.diagram = clg.linkage_print_diagram(linkage_swig_obj, 0, 180)
        self.senses = clg.linkage_print_senses(linkage_swig_obj)
        self.links_and_domains = clg.linkage_print_links_and_domains(linkage_swig_obj)
示例#4
0
def linkage_get_link_length(*args) -> "int" :
  return _clinkgrammar.linkage_get_link_length(*args)
def linkage_get_link_length(*args):
  return _clinkgrammar.linkage_get_link_length(*args)
示例#6
0
def linkage_get_link_length(linkage, index):
    return _clinkgrammar.linkage_get_link_length(linkage, index)
示例#7
0
 def __len__(self):
     return clg.linkage_get_link_length(self.linkage._obj, self.index)
示例#8
0
def linkage_get_link_length(linkage: 'Linkage const',
                            index: 'LinkIdx') -> "int":
    return _clinkgrammar.linkage_get_link_length(linkage, index)
示例#9
0
def linkage_get_link_length(linkage: 'Linkage', index: 'int') -> "int":
    return _clinkgrammar.linkage_get_link_length(linkage, index)
示例#10
0
 def __len__(self):
     return clg.linkage_get_link_length(self.linkage._obj, self.index)