Beispiel #1
0
    def make(self, tree, final_tag_word, follow_tag_word):
        # in utility.py
        final_punc = make_punc(final_tag_word)
        follow_punc = make_punc(follow_tag_word)

        return self.onecount(
            "((%d %d) (%s %s %s))" % (tree.binned_len(), tree.distance, tree.label, final_punc, follow_punc)
        )
Beispiel #2
0
	def count(tree, sentence):
		if tree.is_terminal():
			return None
		
		binned_len = tree.binned_span_width())
		distance = quantize(len(sentence) - tree.span[1])   ## will be moved into tree

		## will be integrated into tree by passing a sentence, but not storing the sentence
		final_punc = make_punc(sentence[tree.span[1] - 1])   
		follow_punc = make_punc(sentence[tree.span[1]])

		return Heavy(binned_len, distance, tree.label, final_punc, follow_punc)