本文整理匯總了Python中jpype.JClass方法的典型用法代碼示例。如果您正苦於以下問題:Python jpype.JClass方法的具體用法?Python jpype.JClass怎麽用?Python jpype.JClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jpype
的用法示例。
在下文中一共展示了jpype.JClass方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: train_evaluate
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def train_evaluate(ratios):
if not os.path.isfile(msr_model):
model = CWSTrainer().train(msr_train, msr_train, msr_model, 0, 10, 8).getModel() # 訓練模型
else:
model = JClass('com.hankcs.hanlp.model.perceptron.model.LinearModel')(msr_model)
pre = None
scores = []
for c in ratios:
if pre:
print('以壓縮比{}壓縮模型中...'.format(c))
model.compress(1 - (1 - c) / pre, 0)
pre = 1 - c
result = CWSEvaluator.evaluate(PerceptronLexicalAnalyzer(model).enableCustomDictionary(False),
msr_test, msr_output, msr_gold, msr_dict)
# scores.append(result.F1)
scores.append(float(str(result).split()[2][3:]))
return scores
示例2: __init__
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def __init__(
self,
jars=None,
jvm_started=False,
mark_time_ranges=False,
include_range=False,
jvm_flags=None,
language="english",
):
"""Initializes SUTime.
"""
self.jars = jars if jars is not None else []
self._check_language_model_dependency(language.lower())
if not jvm_started and not jpype.isJVMStarted():
self._start_jvm(jvm_flags)
if not jpype.isThreadAttachedToJVM():
jpype.attachThreadToJVM()
wrapper = jpype.JClass("edu.stanford.nlp.python.SUTimeWrapper")
self._sutime = wrapper(mark_time_ranges, include_range, language)
示例3: __init__
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def __init__(self,
jvm_started=False,
parse_datetime=False,
minimum_heap_size='128m',
maximum_heap_size='2048m'):
"""Initializes Duckling.
"""
self.parse_datetime = parse_datetime
self._is_loaded = False
self._lock = threading.Lock()
if not jvm_started:
self._classpath = self._create_classpath()
self._start_jvm(minimum_heap_size, maximum_heap_size)
try:
# make it thread-safe
if threading.activeCount() > 1:
if not jpype.isThreadAttachedToJVM():
jpype.attachThreadToJVM()
self._lock.acquire()
self.clojure = jpype.JClass('clojure.java.api.Clojure')
# require the duckling Clojure lib
require = self.clojure.var("clojure.core", "require")
require.invoke(self.clojure.read("duckling.core"))
finally:
self._lock.release()
示例4: clojure
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def clojure():
return jpype.JClass('clojure.java.api.Clojure')
示例5: java_symbol
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def java_symbol():
return jpype.JClass('clojure.lang.Symbol')
示例6: java_boolean
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def java_boolean():
return jpype.JClass('java.lang.Boolean')
示例7: java_string
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def java_string():
return jpype.JClass('java.lang.String')
示例8: java_int
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def java_int():
return jpype.JClass('java.lang.Integer')
示例9: java_arrays
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def java_arrays():
return jpype.JClass('java.util.Arrays')
示例10: java_persistant_array_map
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def java_persistant_array_map():
return jpype.JClass('clojure.lang.PersistentArrayMap')
示例11: java_map_entry
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def java_map_entry():
return jpype.JClass('clojure.lang.MapEntry')
示例12: java_keyword
# 需要導入模塊: import jpype [as 別名]
# 或者: from jpype import JClass [as 別名]
def java_keyword():
return jpype.JClass('clojure.lang.Keyword')