import addrext sequencer = addrext.Sequencer() with open('data/addresses2.csv', 'r') as source: for line in source: expected, max_branch, markers, all_branches, keepers = sequencer.convert_high_address_validate_transform( line.lower(), {}, allthree=True) print(line.strip(), ',"', expected, '","', max_branch, '","', markers, '","', all_branches, '","', keepers, '"')
#!/usr/bin/env python3 import sys def hlight(txt, fg=0, bk=1): print(u"\u001b[{};{};1;{}m{}{}".format(0, fg, bk, txt, u"\u001b[0m")) try: import addrext as ax print("Using PIP installed package!") except: sys.path.append('../') import addrext as ax seq = ax.Sequencer() sent = " ".join(sys.argv[1:]) if not sent: print("\n\tPlease enter an address or string of words after the script.") print("\tFor example: validate_address.py 234 main st") sys.exit(0) hlight("\nInput: " + sent, fg=32, bk=1) print("\nLatent Encoding: ", seq.encode_from_word_list(seq.tokenize_to_list(sent.lower()))) print("\nParse:") for idx, ret in enumerate(seq.parse(sent, allthree=True)):