Return True if the sentence or fragment begins with one of the parts of
    speech in the list, else False
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
1355635
function startsWith(str, test){
  if(str === test){ return true; }
  return str.substring(0, test.length+1) === test+'.';
}
1146708
def subsentence(self):
        '''
        
        '''
        subsentence = []
        for word in self.sentence()[:self._position:-1]:
            # left search
            pass
        for word in self.sentence()[:self._position]:
            # right search
            pass
756453
private boolean startsWithAFilteredPAttern(String string)
    {
        Iterator<String> iterator = filteredFrames.iterator();
        while (iterator.hasNext())
        {
            if (string.trim().startsWith(iterator.next()))
            {
                return true;
            }
        }
        return false;
    }
1352399
private boolean startsWithDelimiter(String word, String[] delimiters) {

        boolean delim = false;
        for (int i = 0; i < delimiters.length; i++) {
            if (word.startsWith(delimiters[i])) {
                delim = true;
                break;
            }
        }
        return delim;
    }
1335774
def start_of_chunk(prev_tag, tag, prev_type, type_):
    
    chunk_start = False

    if tag == 'B': chunk_start = True
    if tag == 'S': chunk_start = True

    if prev_tag == 'E' and tag == 'E': chunk_start = True
    if prev_tag == 'E' and tag == 'I': chunk_start = True
    if prev_tag == 'S' and tag == 'E': chunk_start = True
    if prev_tag == 'S' and tag == 'I': chunk_start = True
    if prev_tag == 'O' and tag == 'E': chunk_start = True
    if prev_tag == 'O' and tag == 'I': chunk_start = True

    if tag != 'O' and tag != '.' and prev_type != type_:
        chunk_start = True

    return chunk_start
1069590
private static boolean isName(final String _text, final boolean isFirstWord, final boolean nextWordIsName) {
        if (hasManyCaps(_text)) return true;
        else if (startsWithCap(_text)) {
            if (isFirstWord) {
                // if the word is the first word in a sentence and
                // ends with -ly (adv) -> consider it not a name
                if (_text.endsWith("ly")) return false;

                // we need to deal with the first word in the sentence very carefully.
                // as we can not tell if the first word is a name by detecting upper case characters.
                final String type_original = Dictionary.checkup(_text);
                final String type_lowercase = Dictionary.checkup(toEngLowerCase(_text));
                if (type_original == null) {
                    // if the word cannot be found in the dictionary, we consider it as a name entity.
                    if (type_lowercase == null) return true;
                }
                else if ("NNP".equals(type_original)) return true;
                //noinspection IfMayBeConditional,SimplifiableIfStatement
                if (startsWith(type_lowercase, "IN", "CC", "RB", "WRB"/*, "JJ"*/, ".")) return false;
                else return nextWordIsName;
            }
            else return true;
        }
        else return false;
    }
348048
def find_start_of_previous_word(self, count=1, WORD=False):
        
        # Reverse the text before the cursor, in order to do an efficient
        # backwards search.
        text_before_cursor = self.text_before_cursor[::-1]

        regex = _FIND_BIG_WORD_RE if WORD else _FIND_WORD_RE
        iterator = regex.finditer(text_before_cursor)

        try:
            for i, match in enumerate(iterator):
                if i + 1 == count:
                    return - match.end(1)
        except StopIteration:
            pass
295098
private boolean containsOnlyInfinitivesToTheLeft(AnalyzedTokenReadings[] tokens, int startPos) throws IOException {
    int infinitives = 0;
    for (int i = startPos; i > 0; i--) {
      String token = tokens[i].getToken();
      if (tokens[i].hasPartialPosTag("SUB:")) {
        AnalyzedTokenReadings lookup = tagger.lookup(token.toLowerCase());
        if (lookup != null && lookup.hasPosTagStartingWith("VER:INF")) {
          infinitives++;
        } else {
          return false;
        }
      }
    }
    return infinitives >= 2;
  }
1130044
public boolean startsWith(Text pattern) {
    	if (pattern == null) {
    		return false;
    	}
    	return this.subSequence(0, pattern.len).equals(pattern);
    }
328789
def _filter_startswith(self, term, field_name, field_type, is_not):
        
        if field_type == 'text':
            if len(term.split()) == 1:
                term = '^ %s*' % term
                query = self.backend.parse_query(term)
            else:
                term = '^ %s' % term
                query = self._phrase_query(term.split(), field_name, field_type)
        else:
            term = '^%s*' % term
            query = self.backend.parse_query(term)

        if is_not:
            return xapian.Query(xapian.Query.OP_AND_NOT, self._all_query(), query)
        return query
1025975
protected boolean filter(IWord word)
    {
        /*
         * normally word with length less than 2 will
         * be something, well could be ignored 
        */
        if ( word.getValue().length() < 2 ) {
            return false;
        }
        
        //type check
        switch ( word.getType() ) {
            //case IWord.T_BASIC_LATIN:
            case IWord.T_LETTER_NUMBER:
            case IWord.T_OTHER_NUMBER:
            case IWord.T_CJK_PINYIN:
            case IWord.T_PUNCTUATION:
            case IWord.T_UNRECOGNIZE_WORD: {
                return false;
            }
        }
        
        //part of speech check
        String[] poss = word.getPartSpeech();
        if ( poss == null ) return true;
        
        char pos = poss[0].charAt(0);
        switch ( pos ) {
            case 'e': {
                if ( poss[0].equals("en") ) return true;
                return false;
            }
            case 'm': {
                if ( poss[0].equals("mix") ) return true;
                return false;
            }
            case 'q':
            case 'b':
            case 'r':
            case 'z':
            case 'p':
            case 'c':
            case 'u':
            case 'y':
            case 'd':    //@date 2015-11-23
            case 'o':
            case 'h':
            case 'k':
            case 'g':
            case 'x':
            case 'w': {
                return false;
            }
            
            /*case 'n':
            case 'v':
            case 'a':
            case 't':
            case 's':
            case 'f':
            {
                return true;
            }*/
        }
        
        return true;
    }
1370355
function isDistinctInterpretationForSame(sentence) {
    var mp = {};
    var res = sentence.every(function (word, index) {
        var seen = mp[word.string];
        if (!seen) {
            mp[word.string] = word;
            return true;
        }
        if (!seen.rule || !word.rule) {
            return true;
        }
        if (seen.rule.bitindex === word.rule.bitindex
            && seen.rule.matchedString !== word.rule.matchedString) {
            //  console.log("skipping this" + JSON.stringify(sentence,undefined,2));
            return false;
        }
        return true;
    });
    return res;
}
66251
private boolean getClause(Iterator tokens, List clause) {
    while(tokens.hasNext()) {
      Object token = tokens.next();
      if (token == matchMany)
        return true;
      clause.add(token);
    }
    return false;
  }
1353535
def contains_shebang(f):
    
    first_line = f.readline()
    if first_line in shebangs.values():
        return True
    return False
725299
function current_word_ends_with(tagged_sentence, i, parameter) {
              var word = tagged_sentence[i][0];
              if (!parameter || (parameter.length > word.length)) {
                return false;
              }
              return(word.indexOf(parameter) === (word.length - parameter.length));
            }
839142
def _isFollowedByComma( wordID, clauseTokens ):
    '''
        
    '''
    koma = WordTemplate({ROOT:'^,+$', POSTAG:'Z'})
    for i in range(len(clauseTokens)):
        token = clauseTokens[i]
        if token[WORD_ID] == wordID:
            if re.match('^.*,$', token[TEXT]):
                return True
            elif i+1 < len(clauseTokens) and koma.matches(clauseTokens[i+1]):
                return True
            break
    return False