Lazy-loads the speaker for this word

        :getter: Returns the plain string value of the speaker tag for the word
        :type: str
189961
def speaker(self):
        
        if self._speaker is None:
            speakers = self._element.xpath('Speaker/text()')
            if len(speakers) > 0:
                self._speaker = speakers[0]
        return self._speaker
1053553
def _get_tag(self, response, tag_name="html", encoding="utf-8"):
        
        def find_tag(tag_name):
            tag_start = tag_end = None
            found = lambda: \
                tag_start is not None and tag_end is not None
            html = self._html.lower()
            start = html.find("<%s" % tag_name)
            if start >= 0:
                tag_start = start
            else:
                return None # no tag
            end = html.find("</%s>" % tag_name)
            if end > tag_start:
                tag_end = end+len(tag_name)+3
            elif consumed:
                tag_end = -1 # till the end
            if found():
                return self._html[tag_start:tag_end]
            return None
        consumed = getattr(response, 'consumed', False)
        if not consumed:
            stream = getattr(response, 'stream', None)
            if stream is None:
                stream = response.iter_content(config.CHUNK_SIZE) # , decode_unicode=True
                response.stream = stream
            while True:
                try:
                    chunk = next(stream)
                    self._html += chunk
                    tag = find_tag(tag_name)
                    if tag:
                        return tag
                    if len(self._html) > config.HTML_MAX_BYTESIZE:
                        raise HTMLParseError('Maximum response size reached.')
                except StopIteration:
                    response.consumed = True
        tag = find_tag(tag_name)
        return decode(tag, encoding)
1069735
def _macronize_word(self, word):
        
        head_word = word[0]
        tag = word[1]
        if tag is None:
            logger.info('Tagger {} could not tag {}.'.format(self.tagger, head_word))
            return head_word, tag, head_word
        elif tag == 'U--------':
            return (head_word, tag.lower(), head_word)
        else:
            entries = self._retrieve_morpheus_entry(head_word)
            if entries is None:
                return head_word, tag.lower(), head_word
            matched_entry = [entry for entry in entries if entry[0] == tag.lower()]
            if len(matched_entry) == 0:
                logger.info('No matching Morpheus entry found for {}.'.format(head_word))
                return head_word, tag.lower(), entries[0][2]
            elif len(matched_entry) == 1:
                return head_word, tag.lower(), matched_entry[0][2].lower()
            else:
                logger.info('Multiple matching entries found for {}.'.format(head_word))
                return head_word, tag.lower(), matched_entry[1][2].lower()
135018
def loads(s, single=False):
    
    corpus = etree.fromstring(s)
    if single:
        ds = _deserialize_mrs(next(corpus))
    else:
        ds = (_deserialize_mrs(mrs_elem) for mrs_elem in corpus)
    return ds
945090
def get_tag(self, key, *, case_sensitive=True):
        
        key = key if case_sensitive else key.lower()
        for tag in self.resource.tags:
            if not case_sensitive:
                if tag.key.lower() == key:
                    return tag
            elif key == tag.key:
                return tag

        return None
366863
def fetch(self):
        
        api = self.doapi_manager
        return api._tag(api.request(self.url)["tag"])
746489
def load(self):
        
        cl_tmp = self.api.list(self.objName, limit=self.searchLimit).values()
        cl = []
        for i in cl_tmp:
            cl.extend(i)
        return {x[self.index]: ItemPuppetClass(self.api, x['id'],
                                               self.objName, self.payloadObj,
                                               x)
                for x in cl}
521027
def get_str(self, key, default=None):
        
        if key:
            for provider in self.providers:
                value = provider.get_str(key)
                if value is not None:
                    return value

        return default
568590
def load_tag(corpus, path):
        
        tag_idx = os.path.basename(path)
        data_path = os.path.join(path, 'by_book')
        tag_utt_ids = []

        for gender_path in MailabsReader.get_folders(data_path):
            # IN MIX FOLDERS THERE ARE NO SPEAKERS
            # HANDLE EVERY UTT AS DIFFERENT ISSUER
            if os.path.basename(gender_path) == 'mix':
                utt_ids = MailabsReader.load_books_of_speaker(corpus,
                                                              gender_path,
                                                              None)

                tag_utt_ids.extend(utt_ids)

            else:
                for speaker_path in MailabsReader.get_folders(gender_path):
                    speaker = MailabsReader.load_speaker(corpus, speaker_path)
                    utt_ids = MailabsReader.load_books_of_speaker(corpus,
                                                                  speaker_path,
                                                                  speaker)

                    tag_utt_ids.extend(utt_ids)

        filter = subset.MatchingUtteranceIdxFilter(
            utterance_idxs=set(tag_utt_ids)
        )
        subview = subset.Subview(corpus, filter_criteria=[filter])
        corpus.import_subview(tag_idx, subview)
1035579
def _get_decoder(self, units, vocab_size, embed, prefix):
        
        with self.name_scope():
            decoder = nn.HybridSequential(prefix=prefix)
            decoder.add(nn.Dense(units, flatten=False))
            decoder.add(GELU())
            decoder.add(BERTLayerNorm(in_channels=units))
            decoder.add(nn.Dense(vocab_size, flatten=False, params=embed.collect_params()))
        assert decoder[3].weight == list(embed.collect_params().values())[0], \
            'The weights of word embedding are not tied with those of decoder'
        return decoder
193420
def speech(self) -> str:
        
        if not self.data:
            self.update()
        return speech.taf(self.data, self.units)
975934
def list_bgp_speaker_on_dragent(self, bgp_dragent, **_params):
        """"""
        return self.get((self.agent_path + self.BGP_DRINSTANCES)
                        % bgp_dragent, params=_params)
604908
def toString(self):
        
        xprofile = self.toXml()
        projex.text.xmlindent(xprofile)
        return ElementTree.tostring(xprofile)
1132552
def voice(self):
        
        if self._voice is None:
            from twilio.rest.voice import Voice
            self._voice = Voice(self)
        return self._voice
641306
def get(self, index, tag=LEMMA):
        
        if tag == WORD:
            return self.words[index]
        if tag == LEMMA:
            return self.words[index].lemma
        if tag == POS:
            return self.words[index].type
        if tag == CHUNK:
            return self.words[index].chunk
        if tag == PNP:
            return self.words[index].pnp
        if tag == REL:
            ch = self.words[index].chunk; return ch and ch.relation
        if tag == ROLE:
            ch = self.words[index].chunk; return ch and ch.role
        if tag == ANCHOR:
            ch = self.words[index].pnp; return ch and ch.anchor
        if tag in self.words[index].custom_tags:
            return self.words[index].custom_tags[tag]
        return None
951625
def load_books_of_speaker(corpus, path, speaker):
        
        utt_ids = []

        for book_path in MailabsReader.get_folders(path):
            meta_path = os.path.join(book_path, 'metadata.csv')
            wavs_path = os.path.join(book_path, 'wavs')

            meta = textfile.read_separated_lines(meta_path,
                                                 separator='|',
                                                 max_columns=3)

            for entry in meta:
                file_basename = entry[0]
                transcription_raw = entry[1]
                transcription_clean = entry[2]

                if speaker is None:
                    idx = file_basename
                    utt_speaker = issuers.Speaker(idx)
                    speaker_idx = idx
                    corpus.import_issuers(utt_speaker)
                else:
                    idx = '{}-{}'.format(speaker.idx, file_basename)
                    speaker_idx = speaker.idx

                wav_name = '{}.wav'.format(file_basename)
                wav_path = os.path.join(wavs_path, wav_name)

                if os.path.isfile(wav_path):
                    corpus.new_file(wav_path, idx)

                    ll_raw = annotations.LabelList.create_single(
                        transcription_raw,
                        idx=audiomate.corpus.LL_WORD_TRANSCRIPT_RAW
                    )

                    ll_clean = annotations.LabelList.create_single(
                        transcription_clean,
                        idx=audiomate.corpus.LL_WORD_TRANSCRIPT
                    )

                    utterance = corpus.new_utterance(idx, idx, speaker_idx)
                    utterance.set_label_list(ll_raw)
                    utterance.set_label_list(ll_clean)

                    utt_ids.append(utterance.idx)

        return utt_ids
351268
def tag_lookup(request):
    
    tag = request.GET['tag']
    tagSlug = slugify(tag.strip())
    tagCandidates = Tag.objects.values('word').filter(slug__startswith=tagSlug)
    tags = json.dumps([candidate['word'] for candidate in tagCandidates])
    return HttpResponse(tags, content_type='application/json')