本文整理匯總了Python中linkgrammar.ParseOptions類的典型用法代碼示例。如果您正苦於以下問題:Python ParseOptions類的具體用法?Python ParseOptions怎麽用?Python ParseOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ParseOptions類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_setting_verbosity
def test_setting_verbosity(self):
po = ParseOptions()
po.verbosity = 2
#Ensure that the PO object reports the value correctly
self.assertEqual(po.verbosity, 2)
#Ensure that it's actually setting it.
self.assertEqual(clg.parse_options_get_verbosity(po._obj), 2)
示例2: test_setting_all_short_connectors
def test_setting_all_short_connectors(self):
po = ParseOptions()
po.all_short_connectors = True
self.assertEqual(po.all_short_connectors, True)
self.assertEqual(clg.parse_options_get_all_short_connectors(po._obj), 1)
po.all_short_connectors = False
self.assertEqual(po.all_short_connectors, False)
self.assertEqual(clg.parse_options_get_all_short_connectors(po._obj), 0)
示例3: test_setting_display_morphology
def test_setting_display_morphology(self):
po = ParseOptions()
po.display_morphology = True
self.assertEqual(po.display_morphology, True)
self.assertEqual(clg.parse_options_get_display_morphology(po._obj), 1)
po.display_morphology = False
self.assertEqual(po.display_morphology, False)
self.assertEqual(clg.parse_options_get_display_morphology(po._obj), 0)
示例4: test_setting_islands_ok
def test_setting_islands_ok(self):
po = ParseOptions()
po.islands_ok = True
self.assertEqual(po.islands_ok, True)
self.assertEqual(clg.parse_options_get_islands_ok(po._obj), 1)
po.islands_ok = False
self.assertEqual(po.islands_ok, False)
self.assertEqual(clg.parse_options_get_islands_ok(po._obj), 0)
示例5: test_setting_max_null_count
def test_setting_max_null_count(self):
po = ParseOptions()
po.max_null_count = 3
self.assertEqual(clg.parse_options_get_max_null_count(po._obj), 3)
示例6: test_setting_disjunct_cost
def test_setting_disjunct_cost(self):
po = ParseOptions()
po.disjunct_cost = 3.0
self.assertEqual(clg.parse_options_get_disjunct_cost(po._obj), 3.0)
示例7: test_setting_linkage_limit
def test_setting_linkage_limit(self):
po = ParseOptions()
po.linkage_limit = 3
self.assertEqual(clg.parse_options_get_linkage_limit(po._obj), 3)
示例8: test_setting_max_parse_time
def test_setting_max_parse_time(self):
po = ParseOptions()
po.max_parse_time = 3
self.assertEqual(clg.parse_options_get_max_parse_time(po._obj), 3)
示例9: test_setting_short_length
def test_setting_short_length(self):
po = ParseOptions()
po.short_length = 3
self.assertEqual(clg.parse_options_get_short_length(po._obj), 3)
示例10: Dictionary
help="show word sentence position")
args.add_argument("-nm", "--no-morphology", dest='morphology', action='store_false',
help="do not display morphology")
args.add_argument("-i", "--interactive", action="store_true",
help="interactive mode after each result")
arg = args.parse_args()
try:
lgdict = Dictionary(arg.lang)
except LG_Error:
# The default error handler will print the error message
args.print_usage()
sys.exit(2)
po = ParseOptions(verbosity=arg.verbosity)
po.max_null_count = 999 # > allowed maximum number of words
po.max_parse_time = 10 # actual parse timeout may be about twice bigger
po.spell_guess = True if DISPLAY_GUESSES else False
po.display_morphology = arg.morphology
# iter(): avoid python2 input buffering
while True:
sentence_text = get_input("sentence-check: ")
if sentence_text.strip() == '':
continue
sent = Sentence(str(sentence_text), lgdict, po)
try:
linkages = sent.parse()