本文整理匯總了Python中quex.engine.misc.interval_handling.NumberSet.get_intervals方法的典型用法代碼示例。如果您正苦於以下問題:Python NumberSet.get_intervals方法的具體用法?Python NumberSet.get_intervals怎麽用?Python NumberSet.get_intervals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quex.engine.misc.interval_handling.NumberSet
的用法示例。
在下文中一共展示了NumberSet.get_intervals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_on_UCS_sample_sets
# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import get_intervals [as 別名]
def test_on_UCS_sample_sets(Trafo, unicode_to_transformed_sequence):
script_list = [
"Arabic", "Armenian", "Balinese", "Bengali", "Bopomofo", "Braille", "Buginese", "Buhid",
"Canadian_Aboriginal", "Cherokee", "Common", "Cuneiform", "Cypriot", "Deseret",
"Gothic", "Greek",
"Hanunoo", "Hebrew", "Hiragana", "Inherited", "Kannada", "Han",
"Katakana", "Kharoshthi", "Khmer", "Lao", "Latin", "Limbu", "Linear_B", "Malayalam",
"Mongolian", "Myanmar", "New_Tai_Lue", "Nko", "Osmanya", "Ogham", "Old_Italic", "Old_Persian",
"Phoenician", "Shavian", "Syloti_Nagri",
"Syriac", "Tagalog", "Tagbanwa", "Tai_Le", "Tamil", "Telugu", "Thaana", "Thai",
"Tibetan", "Tifinagh", "Ugaritic", "Yi"
]
sets = [ X(name) for name in script_list ]
orig = get_combined_state_machine(map(lambda x: x.sm, sets))
state_n_before, result = transform(Trafo, orig)
# print result.get_graphviz_string(Option="hex")
for set in sets:
set.check(result, unicode_to_transformed_sequence)
print "Translated %i groups without abortion on error (OK)" % len(sets)
union = NumberSet()
for nset in map(lambda set: set.charset, sets):
union.unite_with(nset)
inverse_union = NumberSet(Interval(0, 0x110000))
inverse_union.subtract(union)
# print inverse_union.get_string(Option="hex")
check_negative(result, inverse_union.get_intervals(PromiseToTreatWellF=True),
unicode_to_transformed_sequence)
示例2: map
# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import get_intervals [as 別名]
for cmd in result.states[s_idx].single_entry:
assert not cmd.is_acceptance()
print " (OK)"
sets = map(lambda name: X(name),
["Arabic", "Armenian", "Balinese", "Bengali", "Bopomofo", "Braille",
"Hanunoo", "Hebrew", "Hiragana", "Inherited", "Kannada",
"Katakana", "Kharoshthi", "Khmer", "Lao", "Latin", "Limbu", "Linear_B", "Malayalam",
"Mongolian", "Myanmar", "New_Tai_Lue", "Nko", "Ogham", "Old_Italic", "Old_Persian",
"Syriac", "Tagalog", "Tagbanwa", "Tai_Le", "Tamil", "Telugu", "Thaana", "Thai",
"Tibetan", "Tifinagh", "Ugaritic", "Yi"])
orig = get_combined_state_machine(map(lambda x: x.sm, sets))
print "Number of states in state machine:"
print " Unicode: %i" % len(orig.states)
result = trafo.do(orig)
print " UTF8-Splitted: %i" % len(result.states)
for set in sets:
set.check(result)
union = NumberSet()
for nset in map(lambda set: set.charset, sets):
union.unite_with(nset)
inverse_union = NumberSet(Interval(0, 0x110000))
inverse_union.subtract(union)
# print inverse_union.get_string(Option="hex")
check_negative(result, inverse_union.get_intervals(PromiseToTreatWellF=True))