given is at the begining, of is at the end
6152
public float conditionalLogProb(int[] given, int of) {
    if (given.length != windowSize - 1) {
      System.err.println("error computing conditional log prob");
      System.exit(0);
    }
    int[] label = indicesFront(given);
    float[] masses = new float[label.length];
    for (int i = 0; i < masses.length; i++) {
      masses[i] = table[label[i]];
    }
    float z = ArrayMath.logSum(masses);

    return table[indexOf(given, of)] - z;
  }
573690
function findFirst(pred,from,to){// At any point we are certain `to` satisfies `pred`, don't know
// whether `from` does.
var dir=from>to?-1:1;for(;;){if(from==to){return from;}var midF=(from+to)/2,mid=dir<0?Math.ceil(midF):Math.floor(midF);if(mid==from){return pred(mid)?from:to;}if(pred(mid)){to=mid;}else{from=mid+dir;}}}
841204
def is_standalone(text, start, end):
    
    left = False
    start -= 1
    while start >= 0 and text[start] in spaces_not_newline:
        start -= 1

    if start < 0 or text[start] == '\n':
        left = True

    right = re_space.match(text, end)
    return (start+1, right.end()) if left and right else None
661048
def wrap(start: str, string: str, end: str = "") -> str:
    
    return f"{start}{string}{end}" if string else ""
128097
def contains(self, other):
        """"""
        return self._start <= other.start and self._end >= other.end
488999
public boolean hasSpansIntersecting(int start, int end) {
        for (int i = 0; i < numberOfSpans; i++) {
            // equal test is valid since both intervals are not empty by construction
            if (spanStarts[i] >= end || spanEnds[i] <= start) continue;
            return true;
        }
        return false;
    }
131686
def find(self, start, end):
        """"""
        if self.intervals and not end < self.intervals[0].start:
            overlapping = [i for i in self.intervals if i.end >= start
                                                    and i.start <= end]
        else:
            overlapping = []

        if self.left and start <= self.center:
            overlapping += self.left.find(start, end)

        if self.right and end >= self.center:
            overlapping += self.right.find(start, end)

        return overlapping
356303
def p_end(p):
    
    q = make_number(0, lineno=p.lineno(1)) if len(p) == 2 else p[2]
    p[0] = make_sentence('END', q)
193390
def end_at(x, y=nil)
      use_two_cell_anchor unless @anchor.is_a?(TwoCellAnchor)
      @anchor.end_at x, y
      @anchor.to
    end
340983
def _begins_with_one_of(sentence, parts_of_speech):
    """"""
    doc = nlp(sentence)
    if doc[0].tag_ in parts_of_speech:
        return True
    return False
249725
private static int findStart( char[] buffer, int start, int end )
    {
        int pos, cp;
        for ( pos = start; pos < end && isWhitespace( cp = codePointAt( buffer, pos ) ); pos += charCount( cp ) )
        {
            if ( cp == '\n' )
            {
                start = pos + 1;
            }
        }
        return pos >= end ? end : start;
    }
1305788
private static boolean startsWith(List<?> list, List<?> other) {
    return list.size() >= other.size() && list.subList(0, other.size()).equals(other);
  }
1246666
public boolean crosses(Span s) {
    int sstart = s.getStart();
    //either s's start is in this or this' start is in s
    return(!this.contains(s) && !s.contains(this) && 
	   (getStart() <= sstart && sstart < getEnd() ||
	   sstart <= getStart() && getStart() < s.getEnd()));
  }
656350
private boolean includeInStartPosition(final int currentColumn, final int currentRow) {
        
        if(startColumn >=0 && startRow >= 0
                && currentColumn == startColumn && currentRow == startRow) {
            // 行と列の両方の指定がある場合
            return true;
            
        } else if(startColumn >= 0 && startRow < 0 && currentColumn == startColumn) {
            // 列の指定のみ
            return true;
            
        } else if(startColumn < 0 && startRow >= 0 && currentRow == startRow) {
            // 行の指定のみ
            return true;
            
        }
        
        return false;
        
    }
697657
function(start, finish, desc){
        var range = start + '..' + finish;
        this.assert(
            this.obj >= start && this.obj <= finish
            , function(){ return 'expected ' + this.inspect + ' to be within ' + range + (desc ? " | " + desc : "") }
            , function(){ return 'expected ' + this.inspect + ' to not be within ' + range + (desc ? " | " + desc : "") });
        return this;
    }
894862
def map_beginning_of_each(unit, options = {}, &block)
      iterate(unit, options.merge(:map_result => true, :beginning_of => true), &block)
    end
843024
def __findFirstMissing(self, array, start, end):
        
        if (start > end):
            return end + 1

        if (start != array[start]):
            return start

        mid = int((start + end) / 2)

        if (array[mid] == mid):
            return self.__findFirstMissing(array, mid + 1, end)

        return self.__findFirstMissing(array, start, mid)