From a runic inscription, the transcribe method gives a conventional transcription.
        :param rune_sentence: str, elements of this are from runic_alphabet or are punctuations
        :param runic_alphabet: list
        :return:
427805
def transcribe(rune_sentence: str, runic_alphabet: list):
        
        res = []
        d_form_transcription = Transcriber.from_form_to_transcription(runic_alphabet)
        for c in rune_sentence:
            if c in runic_alphabet:
                res.append(d_form_transcription[c])
            elif c in "()":
                res.append(c)
            else:
                res.append(POINT)
        return "".join(res)
214226
def sentence_bytes(self, sentence):
        
        result = [TOKENS[sentence[0]]]

        for i in sentence[1:]:  # Remaining bytes
            if isinstance(i, str):
                result.extend(self.literal(i))
            elif isinstance(i, float) or isinstance(i, int):  # A number?
                result.extend(self.number(i))
            else:
                result.extend(i)  # Must be another thing

        return result
18236
def from_tokens(cls, text, toks):
        
        sentence_pb = CoreNLP_pb2.Sentence()
        sentence_pb.characterOffsetBegin = 0
        sentence_pb.characterOffsetEnd = len(text)
        sentence_pb.sentenceIndex = 0
        sentence_pb.tokenOffsetBegin = 0
        sentence_pb.tokenOffsetEnd = len(toks)

        # Track progress in sentence and tokens.
        char_idx = 0
        tok_idx = 0

        buf = ""
        token_pb = None
        while char_idx < len(text):
            tok = toks[tok_idx]
            # Scan to the beginning of the token.
            if text[char_idx] != tok[0]:
                buf += text[char_idx]
                char_idx += 1
            # Aha! we have found the token. Assert that they match.
            else:
                assert text[char_idx:char_idx+len(tok)] == tok, "text did not match a token"
                # Create a new Token from this text.
                if token_pb: token_pb.after = buf
                token_pb = sentence_pb.token.add()
                token_pb.before = buf

                token_pb.beginChar = char_idx
                token_pb.endChar = char_idx + len(tok)
                # TODO(chaganty): potentially handle -LRB-?
                token_pb.value = tok
                token_pb.word = tok
                token_pb.originalText = text[char_idx:char_idx+len(tok)]

                buf = ""
                char_idx += len(tok)
                tok_idx += 1
        if token_pb: token_pb.after = buf
        assert tok_idx == len(toks), "text does not match all tokens"
        return AnnotatedSentence.from_pb(sentence_pb)
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
1322417
def _gen_sentence(self, assetid_body_tuple):
        '''
         
        '''
        asset_id, body = assetid_body_tuple
        text = self._process(body)
        sentence = LabeledSentence(text, labels=['DOC_%s' % str(asset_id)])
        return sentence
358873
def get_sentence(self, offset: int) -> BioCSentence or None:
        
        for sentence in self.sentences:
            if sentence.offset == offset:
                return sentence
        return None
1295847
def scan_text(self, input_string):
        
        syllables = self._make_syllables(input_string)
        sentence_syllables = self._syllable_condenser(syllables)
        meter = self._scansion(sentence_syllables)
        return meter
641377
def format_sentence(sentence):
    '''  '''
    for index, word in enumerate(sentence):
        if word == 'a' and index + 1 < len(sentence) and \
                re.match(r'^[aeiou]', sentence[index + 1]) and not \
                re.match(r'^uni', sentence[index + 1]):
            sentence[index] = 'an'
    text = ' '.join(sentence)
    text = '%s%s' % (text[0].upper(), text[1:])
    text = text.replace(' ,', ',')
    return '%s.' % text
1019129
def extract_diacritic(*diacritics):
    
    def _(ch):
        decomposed_form = unicodedata.normalize("NFD", ch)
        for diacritic in diacritics:
            if diacritic in decomposed_form:
                return diacritic
    return _
55637
public AnalyzedSentence copy(AnalyzedSentence sentence) {
    AnalyzedTokenReadings[] copyTokens = new AnalyzedTokenReadings[sentence.getTokens().length];
    for (int i = 0; i < copyTokens.length; i++) {
      AnalyzedTokenReadings analyzedTokens = sentence.getTokens()[i];
      copyTokens[i] = new AnalyzedTokenReadings(analyzedTokens.getReadings(), analyzedTokens.getStartPos());
      copyTokens[i].setHistoricalAnnotations(analyzedTokens.getHistoricalAnnotations());
      copyTokens[i].setChunkTags(analyzedTokens.getChunkTags());
      if (analyzedTokens.isImmunized()) {
        copyTokens[i].immunize();
      }
      if (analyzedTokens.isIgnoredBySpeller()) {
        copyTokens[i].ignoreSpelling();
      }
      copyTokens[i].setWhitespaceBefore(sentence.getTokens()[i].isWhitespaceBefore());
    }
    return new AnalyzedSentence(copyTokens, sentence.whPositions, sentence.getTokensWithoutWhitespace(), sentence.getPreDisambigTokensWithoutWhitespace());
  }
1223493
def make_short_sentence(self, max_chars, min_chars=0, **kwargs):
        
        tries = kwargs.get('tries', DEFAULT_TRIES)

        for _ in range(tries):
            sentence = self.make_sentence(**kwargs)
            if sentence and len(sentence) <= max_chars and len(sentence) >= min_chars:
                return 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
149446
def elide_all(self, line: str) -> str:
        
        marks = list(line.translate(self.remove_punct_map))
        all_vowels = self.constants.VOWELS + self.constants.ACCENTED_VOWELS
        tmp = "".join(marks)
        # Elision rules are compound but not cummulative: we place all elision edits into a list
        #  of candidates, and then merge, taking the least of each section of the line.
        candidates = [tmp, self.elide(tmp, r"[{}][{}]\s+[{}]".format(self.constants.CONSONANTS,
                                                                     all_vowels, all_vowels), 1, 1),
                      self.elide(tmp,
                                 r"[{}][{}]\s+[hH]".format(self.constants.CONSONANTS, all_vowels),
                                 1, 1), self.elide(tmp, r"[aāuū]m\s+[{}]".format(all_vowels), 2),
                      self.elide(tmp, r"ae\s+[{}]".format(all_vowels), 2),
                      self.elide(tmp, r"[{}]\s+[{}]".format(all_vowels, all_vowels), 1),
                      self.elide(tmp, r"[uū]m\s+h", 2)]
        results = string_utils.merge_elisions(candidates)
        return results
982893
def _speak_as_literal_punctuation(self, element):
        

        self._speak_as(
            element,
            self._get_regular_expression_of_symbols(),
            'literal-punctuation',
            self._operation_speak_as_literal_punctuation
        )
986581
def _format_notes(self, record):
        
        notes = []

        if "notes" in record:
            for note in record["notes"]:
                self._append_note_dict_to_list(notes, "general", note)

        if "language_and_script_notes" in record:
            self._append_note_dict_to_list(
                notes, "language_and_script", record["language_and_script_notes"]
            )

        if "publication_notes" in record:
            self._append_note_dict_to_list(
                notes, "publication_notes", record["publication_notes"]
            )

        if "physical_characteristics_and_technical_requirements" in record:
            self._append_note_dict_to_list(
                notes,
                "physical_condition",
                record["physical_characteristics_and_technical_requirements"],
            )

        return notes
930651
def sentence2freqt(docgraph, root, successors=None, include_pos=False,
                   escape_func=FREQT_ESCAPE_FUNC):
    """"""
    if successors is None:
        successors = sorted_bfs_successors(docgraph, root)

    if root in successors:  # root node has children / subgraphs
        embed_str = u"".join(sentence2freqt(docgraph, child, successors,
                                            include_pos=include_pos,
                                            escape_func=escape_func)
                             for child in successors[root])
        return node2freqt(
            docgraph, root, embed_str, include_pos=include_pos,
            escape_func=escape_func)
    else:  # root node has no children / subgraphs
        return node2freqt(docgraph, root, include_pos=include_pos,
                          escape_func=escape_func)
837969
def same_document(c):
    
    return all(
        _to_span(c[i]).sentence.document is not None
        and _to_span(c[i]).sentence.document == _to_span(c[0]).sentence.document
        for i in range(len(c))
    )