ret = udct_.add_label(literal, action) if (ret == -2): print('label ' + action + ' not valid !') else: # Set end = $SELECT(command = "\end":1,command = "\noend":0,1:..Err()) if action == "\\end": udct_.add_sent_end_condition(lexrep, True) elif action == "\\noend": udct_.add_sent_end_condition(lexrep, False) else: print('action ' + action + ' not valid !') f_udct.close() # load user dictionary user_dictionary = iknowpy.UserDictionary() read_udct_file(user_dct_par, user_dictionary) ret = engine.load_user_dictionary(user_dictionary) # # process the input and create output # # filename and header f_raw = open( out_path_par + "i.Know." + time.strftime("%Y.%m.%d (%Hu%M)", time.gmtime()) + ".raw", 'wb') f_raw.write(b'\xef\xbb\xbf') # Utf8 BOM write_ln(f_raw, '#') write_ln(f_raw, "# in_path_par:" + in_path_par) write_ln(f_raw, "# out_path_par:" + out_path_par)
print( "ERROR: Unexpected number of trace entries for key '%s'. Found %d instead of %d." % (match_key, match_count, target_count)) else: print("Found %d trace entries for key '%s'" % (match_count / 2, match_key)) return match_count # TODO: grab from command line args debug = False test_sentence = "some text in Fr. w/o one concept and crap one relation that's great and awfull, maybee magic number 3 Hg from future" print("\nBuilding User Dictionary using API...") engine = iknowpy.iKnowEngine() user_dictionary = iknowpy.UserDictionary() user_dictionary.add_label("some text", "UDConcept;UDUnit") # following line will throw an exception : Unkown label # user_dictionary.add_label("tik tok", "UDUnknown") user_dictionary.add_sent_end_condition("Fr.", False) user_dictionary.add_concept("one concept") user_dictionary.add_relation("one relation") user_dictionary.add_non_relevant("crap") user_dictionary.add_negation("w/o") user_dictionary.add_positive_sentiment("great") user_dictionary.add_negative_sentiment("awfull") user_dictionary.add_unit("Hg") user_dictionary.add_number("magic number") user_dictionary.add_time("future") user_dictionary.add_certainty_level("maybee", 2)