Returns a list of all matches found in the given sentence.
495548
def search(self, sentence):
        
        if sentence.__class__.__name__ == "Sentence":
            pass
        elif isinstance(sentence, list) or sentence.__class__.__name__ == "Text":
            a=[]; [a.extend(self.search(s)) for s in sentence]; return a
        elif isinstance(sentence, basestring):
            sentence = Sentence(sentence)
        elif isinstance(sentence, Match) and len(sentence) > 0:
            sentence = sentence[0].sentence.slice(sentence[0].index, sentence[-1].index + 1)
        a = []
        v = self._variations()
        u = {}
        m = self.match(sentence, _v=v)
        while m:
            a.append(m)
            m = self.match(sentence, start=m.words[-1].index+1, _v=v, _u=u)
        return a
209076
def match_regex_list(patterns, string):
    """"""

    for p in patterns:

        if re.findall(p, string):
            return True

    return False
1102241
def findall(self, string):
        
        output = []
        for match in self.pattern.findall(string):
            if hasattr(match, 'strip'):
                match = [match]
            self._list_add(output, self.run(match))
        return output
638516
def _sentence(self, words):
        """"""
        db = self.database

        # Generate 2 words to start a sentence with
        seed = random.randint(0, db['word_count'] - 3)
        seed_word, next_word = db['words'][seed], db['words'][seed + 1]
        w1, w2 = seed_word, next_word

        # Generate the complete sentence
        sentence = []
        for i in range(0, words - 1):
            sentence.append(w1)
            w1, w2 = w2, random.choice(db['freqs'][(w1, w2)])
        sentence.append(w2)

        # Make the sentence respectable
        sentence = ' '.join(sentence)

        # Capitalize the sentence
        sentence = sentence.capitalize()

        # Remove additional sentence ending puntuation
        sentence = sentence.replace('.', '')
        sentence = sentence.replace('!', '')
        sentence = sentence.replace('?', '')
        sentence = sentence.replace(':', '')

        # Remove quote tags
        sentence = sentence.replace('.', '')
        sentence = sentence.replace('!', '')
        sentence = sentence.replace('?', '')
        sentence = sentence.replace(':', '')
        sentence = sentence.replace('"', '')

        # If the last character is not an alphanumeric remove it
        sentence = re.sub('[^a-zA-Z0-9]$', '', sentence)

        # Remove excess space
        sentence = re.sub('\s+', ' ', sentence)

        # Add a full stop
        sentence += '.'

        return sentence
299455
def extract_keywords_from_sentences(self, sentences):
        
        phrase_list = self._generate_phrases(sentences)
        self._build_frequency_dist(phrase_list)
        self._build_word_co_occurance_graph(phrase_list)
        self._build_ranklist(phrase_list)
448465
def list(self):
        """"""
        start = self.tokens.matched.start

        if self.tokens.accept(common_grammar.rbracket):
            return ast.Tuple(start=start, end=self.tokens.matched.end,
                             source=self.original)

        elements = [self.expression()]

        while self.tokens.accept(common_grammar.comma):
            elements.append(self.expression())

        self.tokens.expect(common_grammar.rbracket)
        return ast.Tuple(*elements, start=start, end=self.tokens.matched.end,
                         source=self.original)
817839
def sentences(self):
        """"""
        sents = []
        spans = self.sentence_tokenizer.span_tokenize(self.text)
        for span in spans:
            sent = Sentence(
                text=self.text[span[0]:span[1]],
                start=span[0],
                end=span[1],
                word_tokenizer=self.word_tokenizer,
                lexicon=self.lexicon,
                abbreviation_detector=self.abbreviation_detector,
                pos_tagger=self.pos_tagger,
                ner_tagger=self.ner_tagger,
                parsers=self.parsers,
                document=self.document
            )
            sents.append(sent)
        return sents
1018915
def sentence_texts(self):
        """"""
        if not self.is_tagged(SENTENCES):
            self.tokenize_sentences()
        return self.texts(SENTENCES)
767683
@Override
  public RuleMatch[] match(AnalyzedSentence sentence) throws IOException {
    List<RuleMatch> ruleMatches = new ArrayList<>();

    // Let's get all the tokens (i.e. words) of this sentence, but not the spaces:
    AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace();
    
    // No let's iterate over those - note that the first token will
    // be a special token that indicates the start of a sentence:
    for (AnalyzedTokenReadings token : tokens) {
      
      System.out.println("Token: " + token.getToken());  // the original word from the input text
      
      // A word can have more than one reading, e.g. 'dance' can be a verb or a noun,
      // so we iterate over the readings:
      for (AnalyzedToken analyzedToken : token.getReadings()) {
        System.out.println("  Lemma: " + analyzedToken.getLemma());
        System.out.println("  POS: " + analyzedToken.getPOSTag());
      }
      
      // You can add your own logic here to find errors. Here, we just consider
      // the word "demo" an error and create a rule match that LanguageTool will
      // then show to the user:
      if (token.getToken().equals("demo")) {
        RuleMatch ruleMatch = new RuleMatch(this, sentence, token.getStartPos(), token.getEndPos(), "The demo rule thinks this looks wrong");
        ruleMatch.setSuggestedReplacement("blablah");  // the user will see this as a suggested correction
        ruleMatches.add(ruleMatch);
      }
    }

    return toRuleMatchArray(ruleMatches);
  }
430540
def parse_sentence(self, string):
        

        result = []

        def shift(string_):
            """ Returns first word of a string, and remaining
            """
            string_ = string_.strip()  # Remove spaces and tabs

            if not string_:  # Avoid empty strings
                return '', ''

            i = string_.find(' ')
            if i == -1:
                command_ = string_
                string_ = ''
            else:
                command_ = string_[:i]
                string_ = string_[i:]

            return command_, string_

        command, string = shift(string)
        while command != '':
            result += self.token(command)
1115722
def _get_sentences_with_word_count(sentences, words):
    
    word_count = 0
    selected_sentences = []
    # Loops until the word count is reached.
    for sentence in sentences:
        words_in_sentence = len(sentence.text.split())

        # Checks if the inclusion of the sentence gives a better approximation
        # to the word parameter.
        if abs(words - word_count - words_in_sentence) > abs(words - word_count):
            return selected_sentences

        selected_sentences.append(sentence)
        word_count += words_in_sentence

    return selected_sentences
576780
def sentences(ctx, input, output):
    """"""
    log.info('chemdataextractor.read.elements')
    log.info('Reading %s' % input.name)
    doc = Document.from_file(input)
    for element in doc.elements:
        if isinstance(element, Text):
            for raw_sentence in element.raw_sentences:
                output.write(raw_sentence.strip())
                output.write(u'\n')
996897
public List<AnalyzedSentence> analyzeText(String text) throws IOException {
    List<String> sentences = sentenceTokenize(text);
    return analyzeSentences(sentences);
  }
1050062
public List<String> segment(String sentence)
    {
        return segment(sentence, CharTable.convert(sentence));
    }
827316
def search(pattern, sentence, *args, **kwargs):
    
    return compile(pattern, *args, **kwargs).search(sentence)
1275143
def get_matches(pattern, language, max_count=8):
    
    if str(pattern) == pattern:
        pattern = compile_pattern(pattern)

    results = []

    if not dicts.exists(language):
        print("The language '%s' is not available locally." % language)
        return []

    with open(dicts.filepath(language), 'r') as f:
        for word in f:
            if max_count <= 0:
                break
            w = word.strip()
            if pattern.match(w) and w not in results:
                results.append(w)
                max_count -= 1

    return results
409168
def listup_sentence(self, data, counter=0):
        '''
        

        '''
        delimiter = self.delimiter_list[counter]
        sentence_list = []
        [sentence_list.append(sentence + delimiter) for sentence in data.split(delimiter) if sentence != ""]
        if counter + 1 < len(self.delimiter_list):
            sentence_list_r = []
            [sentence_list_r.extend(self.listup_sentence(sentence, counter+1)) for sentence in sentence_list]
            sentence_list = sentence_list_r

        return sentence_list