How to use the pyknp.Subprocess function in pyknp

To help you get started, we’ve selected a few pyknp 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 ku-nlp / pyknp / pyknp / juman / jumanpp.py View on Github external
def jumanpp_lines(self, input_str):
        if not self.subprocess:
            command = "%s %s" % (self.command, self.option)
            self.subprocess = Subprocess(command)
        return self.subprocess.query(input_str, pattern=self.pattern)
github Kensuke-Mitsuzawa / JapaneseTokenizers / JapaneseTokenizer / juman_wrapper / juman_wrapper.py View on Github external
def __monkey_patch_juman_lines(self, input_str):
        # type: (text_type)->text_type
        """* What you can do
        - It overwrites juman_line() method because this method causes TypeError in python3
        """
        assert isinstance(self.juman, pyknp.Juman)
        if not self.juman.socket and not self.juman.subprocess:
            if self.juman.server is not None:
                self.juman.socket = MonkeyPatchSocket(self.juman.server, self.juman.port, b"RUN -e2\n")
            else:
                command = "%s %s" % (self.juman.command, self.juman.option)
                if self.juman.rcfile:
                    command += " -r %s" % self.juman.rcfile
                self.juman.subprocess = pyknp.Subprocess(command)
        if self.juman.socket:
            return self.juman.socket.query(input_str, pattern=self.juman.pattern)
        return self.juman.subprocess.query(input_str, pattern=self.juman.pattern)

pyknp

Python module for JUMAN/KNP

See COPYING
Latest version published 3 years ago

Package Health Score

52 / 100
Full package analysis

Similar packages