How to use the konlpy.jvm 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 / tag / _kkma.py View on Github external
def __init__(self, jvmpath=None):
        if not jpype.isJVMStarted():
            jvm.init_jvm(jvmpath)

        kkmaJavaPackage = jpype.JPackage('kr.lucypark.kkma')
        KkmaInterfaceJavaClass = kkmaJavaPackage.KkmaInterface
        self.jki = KkmaInterfaceJavaClass()  # Java instance
        self.tagset = utils.read_json('%s/data/tagset/kkma.json' % utils.installpath)
github konlpy / konlpy / konlpy / tag / _twitter.py View on Github external
def __init__(self, jvmpath=None):
        if not jpype.isJVMStarted():
            jvm.init_jvm(jvmpath)

        tktJavaPackage = jpype.JPackage('kr.lucypark.tkt')
        TktInterfaceJavaClass = tktJavaPackage.TktInterface
        self.jki = TktInterfaceJavaClass()
        self.tagset = utils.read_json('%s/data/tagset/twitter.json' % utils.installpath)
github konlpy / konlpy / konlpy / tag / _komoran.py View on Github external
def __init__(self, jvmpath=None, dicpath=None):
        if not jpype.isJVMStarted():
            jvm.init_jvm(jvmpath)
        komoranJavaPackage = jpype.JPackage('kr.lucypark.komoran')
        KomoranInterfaceJavaClass = komoranJavaPackage.KomoranInterface
        try:
            self.jki = KomoranInterfaceJavaClass()
        except TypeError:  # Package kr.lucypark.komoran.KomoranInterface is not Callable
            raise IOError("Cannot access komoran-dic. Please leave an issue at https://github.com/konlpy/konlpy/issues")

        if dicpath:
            self.dicpath = dicpath
        else:
            # FIXME: Cannot execute without sudoing
            # java.lang.NoClassDefFoundErrorPyRaisable: java.lang.NoClassDefFoundError: kr/co/shineware/nlp/komoran/core/analyzer/Komoran
            self.dicpath = os.path.join(utils.installpath, 'java', 'data', 'models')
            self.tagset = utils.read_json('%s/data/tagset/komoran.json' % utils.installpath)
github konlpy / konlpy / konlpy / tag / _hannanum.py View on Github external
def __init__(self, jvmpath=None):
        if not jpype.isJVMStarted():
            jvm.init_jvm(jvmpath)

        jhannanumJavaPackage = jpype.JPackage('kr.lucypark.jhannanum.comm')
        HannanumInterfaceJavaClass = jhannanumJavaPackage.HannanumInterface
        self.jhi = HannanumInterfaceJavaClass()  # Java instance
        self.tagset = utils.read_json('%s/data/tagset/hannanum.json' % utils.installpath)