Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 4
0
def linkage_get_link_rlabel(*args) -> "char const *" :
  return _clinkgrammar.linkage_get_link_rlabel(*args)
Exemplo n.º 5
0
def linkage_get_link_rlabel(*args):
  return _clinkgrammar.linkage_get_link_rlabel(*args)
Exemplo n.º 6
0
def linkage_get_link_rlabel(linkage, index):
    return _clinkgrammar.linkage_get_link_rlabel(linkage, index)
Exemplo n.º 7
0
 def link(self, i):
     return Link(self, i, self.word(clg.linkage_get_link_lword(self._obj, i)),
                 clg.linkage_get_link_llabel(self._obj, i),
                 clg.linkage_get_link_rlabel(self._obj, i),
                 self.word(clg.linkage_get_link_rword(self._obj, i)))
Exemplo n.º 8
0
def linkage_get_link_rlabel(linkage: 'Linkage const',
                            index: 'LinkIdx') -> "char const *":
    return _clinkgrammar.linkage_get_link_rlabel(linkage, index)
Exemplo n.º 9
0
 def link(self, i):
     return Link(self, i,
                 self.word(clg.linkage_get_link_lword(self._obj, i)),
                 clg.linkage_get_link_llabel(self._obj, i),
                 clg.linkage_get_link_rlabel(self._obj, i),
                 self.word(clg.linkage_get_link_rword(self._obj, i)))
Exemplo n.º 10
0
def linkage_get_link_rlabel(*args) -> "char const *":
    return _clinkgrammar.linkage_get_link_rlabel(*args)