How to use the konlpy.data.StringWriter function in konlpy

To help you get started, we’ve selected a few konlpy 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 konlpy / konlpy / konlpy / stream / google_trend.py View on Github external
def job(self):
        colorama.init()
        writer = StringWriter(self.options.filename)

        def summary(result):
            for content in result:
                if not self.options.metadata_to_dict:
                    if self.options.verbose:
                        pprint(Fore.CYAN + content['date'] + Fore.RESET)
                        pprint(Fore.CYAN + Style.DIM + content['title'] + Style.RESET_ALL + Fore.RESET)
                        pprint(Fore.CYAN + Style.DIM * 2 + content['traffic'] + Style.RESET_ALL + Fore.RESET)
                    writer.write("@date:" + content['date'])
                    writer.write("@title:" + content['title'])
                    writer.write("@traffic:" + content['traffic'])
                else:
                    output = '\t'.join([content['date'], content['title'], content['traffic']])
                    if self.options.verbose:
                        pprint(output)
                    writer.write(output)
github konlpy / konlpy / konlpy / stream / dcinside.py View on Github external
def job(self):
        colorama.init()
        writer = StringWriter(self.options.filename)

        def summary(result):
            if not self.options.metadata_to_dict:
                if self.options.verbose:
                    pprint(Fore.CYAN + result['title'] + Fore.RESET)
                    pprint(Fore.CYAN + Style.DIM + result['written_at'] + Style.RESET_ALL + Fore.RESET)
                    pprint(result['body'])
                writer.write("@title:" + result['title'])
                writer.write("@written_at:" + result['written_at'])
                writer.write("@body:" + result['body'])
            else:
                if self.options.verbose:
                    pprint(result)
                writer.write(result)

        while (self.options.final_post_id > self._current_post_id) | self.options.forever:
github konlpy / konlpy / konlpy / stream / daum.py View on Github external
type=int
        )
        parser.add_argument(
            '-n', '--n_limits',
            help="stop when this amount of trends are collected. 0 for forever",
            default=10,
            type=int
        )
        parser.add_argument(
            '--filename',
            help="filename to be saved.",
            default="trends.txt"
        )

        self.options, _ = parser.parse_known_args()
        self.writer = StringWriter(self.options.filename)
github konlpy / konlpy / konlpy / stream / naver.py View on Github external
type=int
        )
        parser.add_argument(
            '-n', '--n_limits',
            help="stop when this amount of trends are collected. 0 for forever",
            default=10,
            type=int
        )
        parser.add_argument(
            '--filename',
            help="filename to be saved.",
            default="trends.txt"
        )

        self.options, _ = parser.parse_known_args()
        self.writer = StringWriter(self.options.filename)