Skip to content

Commit

Permalink
Fix #199
Browse files Browse the repository at this point in the history
  • Loading branch information
lovit committed Jul 31, 2018
1 parent c1dbc2a commit 91a181d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions konlpy/jvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from konlpy import utils


def init_jvm(jvmpath=None):
def init_jvm(jvmpath=None, max_heap_size=1024):
"""Initializes the Java virtual machine (JVM).
:param jvmpath: The path of the JVM. If left empty, inferred by :py:func:`jpype.getDefaultJVMPath`.
Expand Down Expand Up @@ -62,6 +62,6 @@ def init_jvm(jvmpath=None):
if jvmpath:
jpype.startJVM(jvmpath, '-Djava.class.path=%s' % classpath,
'-Dfile.encoding=UTF8',
'-ea', '-Xmx1024m')
'-ea', '-Xmx{}m'.format(max_heap_size))
else:
raise ValueError("Please specify the JVM path.")
4 changes: 2 additions & 2 deletions konlpy/tag/_hannanum.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def morphs(self, phrase):

return [s for s, t in self.pos(phrase)]

def __init__(self, jvmpath=None):
def __init__(self, jvmpath=None, max_heap_size=1024):
if not jpype.isJVMStarted():
jvm.init_jvm(jvmpath)
jvm.init_jvm(jvmpath, max_heap_size)

jhannanumJavaPackage = jpype.JPackage('kr.lucypark.jhannanum.comm')
HannanumInterfaceJavaClass = jhannanumJavaPackage.HannanumInterface
Expand Down
4 changes: 2 additions & 2 deletions konlpy/tag/_kkma.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def sentences(self, phrase):
if not sentences: return []
return [sentences.get(i).getSentence() for i in range(sentences.size())]

def __init__(self, jvmpath=None):
def __init__(self, jvmpath=None, max_heap_size=1024):
if not jpype.isJVMStarted():
jvm.init_jvm(jvmpath)
jvm.init_jvm(jvmpath, max_heap_size)

kkmaJavaPackage = jpype.JPackage('kr.lucypark.kkma')
KkmaInterfaceJavaClass = kkmaJavaPackage.KkmaInterface
Expand Down
4 changes: 2 additions & 2 deletions konlpy/tag/_komoran.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def morphs(self, phrase):

return [s for s, t in self.pos(phrase)]

def __init__(self, jvmpath=None, userdic=None, modelpath=None):
def __init__(self, jvmpath=None, userdic=None, modelpath=None, max_heap_size=1024):
if not jpype.isJVMStarted():
jvm.init_jvm(jvmpath)
jvm.init_jvm(jvmpath, max_heap_size)

if modelpath:
self.modelpath = modelpath
Expand Down
4 changes: 2 additions & 2 deletions konlpy/tag/_okt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def phrases(self, phrase):

return [p for p in self.jki.phrases(phrase).toArray()]

def __init__(self, jvmpath=None):
def __init__(self, jvmpath=None, max_heap_size=1024):
if not jpype.isJVMStarted():
jvm.init_jvm(jvmpath)
jvm.init_jvm(jvmpath, max_heap_size)

oktJavaPackage = jpype.JPackage('kr.lucypark.okt')
OktInterfaceJavaClass = oktJavaPackage.OktInterface
Expand Down

0 comments on commit 91a181d

Please sign in to comment.