How to use the pycantonese.util.ListFromIterables function in pycantonese

To help you get started, we’ve selected a few pycantonese examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jacksonllee / pycantonese / pycantonese / corpus.py View on Github external
:param participant: Specify the participant(s); defaults to all
            participants.

        :param by_files: If True (default: False), return dict(absolute-path
            filename: X for that file) instead of X for all files altogether.

        :rtype: list(list(str)), or dict(str: list(list(str)))
        """
        fn_to_characters = self._get_character_sents(
            participant=participant, exclude=exclude, sents=True
        )

        if by_files:
            return fn_to_characters
        else:
            return ListFromIterables(
                *(v for _, v in sorted(fn_to_characters.items()))
            )
github jacksonllee / pycantonese / pycantonese / corpus.py View on Github external
tone=tone,
            initial=initial,
            final=final,
            jyutping=jyutping,
            character=character,
            pos=pos,
            word_range=word_range,
            sent_range=sent_range,
            tagged=tagged,
            sents=sents,
        )

        if by_files:
            return fn_to_results
        else:
            return ListFromIterables(
                *(v for _, v in sorted(fn_to_results.items()))
            )
github jacksonllee / pycantonese / pycantonese / util.py View on Github external
def __init__(self, *iterables):
        super(ListFromIterables, self).__init__()
        self.input_iterables = iterables
        self.from_iterables()
github jacksonllee / pycantonese / pycantonese / corpus.py View on Github external
:param participant: Specify the participant(s); defaults to all
            participants.

        :param by_files: If True (default: False), return dict(absolute-path
            filename: X for that file) instead of X for all files altogether.

        :rtype: list(str), or dict(str: list(str))
        """
        fn_to_jyutpings = self._get_jyutping_sents(
            participant=participant, exclude=exclude, sents=False
        )

        if by_files:
            return fn_to_jyutpings
        else:
            return ListFromIterables(
                *(v for _, v in sorted(fn_to_jyutpings.items()))
            )
github jacksonllee / pycantonese / pycantonese / corpus.py View on Github external
:param participant: Specify the participant(s); defaults to all
            participants.

        :param by_files: If True (default: False), return dict(absolute-path
            filename: X for that file) instead of X for all files altogether.

        :rtype: list(list(str)), or dict(str: list(list(str)))
        """
        fn_to_jyutpings = self._get_jyutping_sents(
            participant=participant, exclude=exclude, sents=True
        )

        if by_files:
            return fn_to_jyutpings
        else:
            return ListFromIterables(
                *(v for _, v in sorted(fn_to_jyutpings.items()))
            )
github jacksonllee / pycantonese / pycantonese / corpus.py View on Github external
:param participant: Specify the participant(s); defaults to all
            participants.

        :param by_files: If True (default: False), return dict(absolute-path
            filename: X for that file) instead of X for all files altogether.

        :rtype: list(str), or dict(str: list(str))
        """
        fn_to_characters = self._get_character_sents(
            participant=participant, exclude=exclude, sents=False
        )

        if by_files:
            return fn_to_characters
        else:
            return ListFromIterables(
                *(v for _, v in sorted(fn_to_characters.items()))
            )