def overlapping_chars(ann1, annotations):
    annotations = [ann2 for ann2 in annotations if is_overlapping(ann1, ann2)]
    if len(annotations) == 0 or not isinstance(ann1, Annotation):
        return 0
    this_overlaps = zeros(ann1[TLEN], dtype=bool)
    source_overlaps = zeros(ann1[SLEN], dtype=bool)
    for ann2 in annotations:
        mark_overlapping_chars(this_overlaps, ann1, ann2, TOFF, TLEN)
        mark_overlapping_chars(source_overlaps, ann1, ann2, SOFF, SLEN)
    return npsum(this_overlaps) + npsum(source_overlaps)
예제 #2
0
 def overlapping_chars(self, ann1, annotations):
     """Returns the number of chars in ann1 that overlap with the annotations."""
     annotations = [ann2 for ann2 in annotations if self.is_overlapping(ann1, ann2)]
     if len(annotations) == 0 or not isinstance(ann1, self.Annotation):
         return 0
     this_overlaps = zeros(ann1[self.TLEN], dtype=bool)
     source_overlaps = zeros(ann1[self.SLEN], dtype=bool)
     for ann2 in annotations:
         self.mark_overlapping_chars(this_overlaps, ann1, ann2, self.TOFF, self.TLEN)
         self.mark_overlapping_chars(source_overlaps, ann1, ann2, self.SOFF, self.SLEN)
     return npsum(this_overlaps) + npsum(source_overlaps)
예제 #3
0
def overlapping_chars(ann1, annotations):
    """Returns the number of chars in ann1 that overlap with the annotations."""
    annotations = [ann2 for ann2 in annotations if is_overlapping(ann1, ann2)]
    if len(annotations) == 0 or not isinstance(ann1, Annotation):
        return 0
    this_overlaps = zeros(ann1[TLEN], dtype=bool)
    source_overlaps = zeros(ann1[SLEN], dtype=bool)
    for ann2 in annotations:
        mark_overlapping_chars(this_overlaps, ann1, ann2, TOFF, TLEN)
        mark_overlapping_chars(source_overlaps, ann1, ann2, SOFF, SLEN)
    return npsum(this_overlaps) + npsum(source_overlaps)
def overlapping_chars(ann1, annotations, xoff, xlen):
    """Returns the number of chars in ann1 that overlap with the annotations."""
    annotations = [ann2 for ann2 in annotations if is_overlapping(ann1, ann2)]
    if len(annotations) == 0 or not isinstance(ann1, Annotation):
        return 0
    overlaps = zeros(ann1[xlen], dtype=bool)
    for ann2 in annotations:
        mark_overlapping_chars(overlaps, ann1, ann2, xoff, xlen)
    return npsum(overlaps)
def count_chars2(annotations, xref, xoff, xlen):
    num_chars = 0
    max_length = max((ann[xoff] + ann[xlen] for ann in annotations))
    char_bits = zeros(max_length, dtype=bool)
    xref_index = index_annotations(annotations, xref)
    for xref in xref_index:
        annotations = xref_index[xref]
        char_bits[:] = False
        for ann in annotations:
            char_bits[ann[xoff]:ann[xoff] + ann[xlen]] = True
        num_chars += npsum(char_bits)
    return num_chars
예제 #6
0
 def count_chars2(self, annotations, xref, xoff, xlen):
     """Returns the number of cvhars covered by the annotations with regard to
        the keys xref, xoff, and xlen."""
     num_chars = 0
     max_length = max((ann[xoff] + ann[xlen] for ann in annotations))
     char_bits = zeros(max_length, dtype=bool)
     xref_index = self.index_annotations(annotations, xref)
     for xref in xref_index:
         annotations = xref_index[xref]
         char_bits[:] = False
         for ann in annotations:
             char_bits[ann[xoff]:ann[xoff] + ann[xlen]] = True
         num_chars += npsum(char_bits)
     return num_chars
예제 #7
0
def count_chars2(annotations, xref, xoff, xlen):
    """Returns the number of cvhars covered by the annotations with regard to
       the keys xref, xoff, and xlen."""
    num_chars = 0
    max_length = max((ann[xoff] + ann[xlen] for ann in annotations))
    char_bits = zeros(max_length, dtype=bool)
    xref_index = index_annotations(annotations, xref)
    for xref in xref_index:
        annotations = xref_index[xref]
        char_bits[:] = False
        for ann in annotations:
            char_bits[ann[xoff]:ann[xoff] + ann[xlen]] = True
        num_chars += npsum(char_bits)
    return num_chars
예제 #8
0
#! /usr/bin/python