Added input classifier
This commit is contained in:
parent
e3094ad67a
commit
7318ed3e31
@ -37,6 +37,26 @@ for word in allList:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
'''def className(rawstring):
|
||||||
|
# Create a list that contains @ , # , * and : ; in actual order of occurence with their words. Only : is allowed to exist without a word in front of it.
|
||||||
|
# Check for 1 @ only followed by :, and the class is trigger
|
||||||
|
# Check for 1 # only, then the class is tokensystem
|
||||||
|
# Check for @ in the first position, * in the second position, # in the third position and : in the fourth position, then class is one time event creation
|
||||||
|
# Check for @ in the first position, * in the second position and : in the third position, then hash is in 4th position, then hash in 5th position | Token swap creation
|
||||||
|
|
||||||
|
allList = findrules(rawstring,['#','*','@',':'])
|
||||||
|
|
||||||
|
pattern_list1 = ['rmt@','rmt*',':',"rmt#","rmt#"]
|
||||||
|
pattern_list2 = ['rmt#',':',"rmt@"]
|
||||||
|
pattern_list3 = ['rmt#']
|
||||||
|
pattern_list4 = ["rmt@","one-time-event*","floAddress$",':',"rupee#","bioscope#"]
|
||||||
|
patternmatch = find_first_classification(pattern_list4, search_patterns)
|
||||||
|
print(f"Patternmatch is {patternmatch}")
|
||||||
|
|
||||||
|
|
||||||
|
rawstring = "test rmt# rmt@ rmt* : rmt# rmt# test"
|
||||||
|
#className(rawstring) '''
|
||||||
|
|
||||||
search_patterns = {
|
search_patterns = {
|
||||||
'tokensystem-C':{
|
'tokensystem-C':{
|
||||||
1:['#']
|
1:['#']
|
||||||
@ -124,10 +144,8 @@ def sort_specialcharacter_wordlist(inputlist):
|
|||||||
def classify_rawstring(rawstring):
|
def classify_rawstring(rawstring):
|
||||||
specialcharacter_wordlist = extract_specialcharacter_words(rawstring,['@','*','$','#',':'])
|
specialcharacter_wordlist = extract_specialcharacter_words(rawstring,['@','*','$','#',':'])
|
||||||
print(specialcharacter_wordlist)
|
print(specialcharacter_wordlist)
|
||||||
first_classication = find_first_classification(specialcharacter_wordlist, search_patterns)
|
first_classification = find_first_classification(specialcharacter_wordlist, search_patterns)
|
||||||
|
return first_classification
|
||||||
if first_classication ==
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def checkSearchPattern(parsed_list, searchpattern):
|
def checkSearchPattern(parsed_list, searchpattern):
|
||||||
@ -140,25 +158,6 @@ def checkSearchPattern(parsed_list, searchpattern):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def className(rawstring):
|
|
||||||
# Create a list that contains @ , # , * and : ; in actual order of occurence with their words. Only : is allowed to exist without a word in front of it.
|
|
||||||
# Check for 1 @ only followed by :, and the class is trigger
|
|
||||||
# Check for 1 # only, then the class is tokensystem
|
|
||||||
# Check for @ in the first position, * in the second position, # in the third position and : in the fourth position, then class is one time event creation
|
|
||||||
# Check for @ in the first position, * in the second position and : in the third position, then hash is in 4th position, then hash in 5th position | Token swap creation
|
|
||||||
|
|
||||||
allList = findrules(rawstring,['#','*','@',':'])
|
|
||||||
|
|
||||||
pattern_list1 = ['rmt@','rmt*',':',"rmt#","rmt#"]
|
|
||||||
pattern_list2 = ['rmt#',':',"rmt@"]
|
|
||||||
pattern_list3 = ['rmt#']
|
|
||||||
pattern_list4 = ["rmt@","one-time-event*","floAddress$",':',"rupee#","bioscope#"]
|
|
||||||
patternmatch = find_first_classification(pattern_list4, search_patterns)
|
|
||||||
print(f"Patternmatch is {patternmatch}")
|
|
||||||
|
|
||||||
|
|
||||||
rawstring = "test rmt# rmt@ rmt* : rmt# rmt# test"
|
|
||||||
#className(rawstring)
|
|
||||||
text_list = [
|
text_list = [
|
||||||
"create 500 million rmt#",
|
"create 500 million rmt#",
|
||||||
|
|
||||||
@ -182,4 +181,4 @@ text_list = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
for text in text_list:
|
for text in text_list:
|
||||||
print(f"{classify_rawstring(text)} \n\n")
|
print(f"{classify_rawstring(text)} \n\n")
|
||||||
Loading…
Reference in New Issue
Block a user