diff --git a/parse_flodata.py b/parse_flodata.py index 572737e..5d9b1dc 100644 --- a/parse_flodata.py +++ b/parse_flodata.py @@ -22,6 +22,15 @@ def isIncorp(text): return True return False + +def extractMarker(text): + textList = text.split(' ') + for word in textList: + if word[-1] == '#': + return word + return False + + def extractOperation(text): operationList = ['send', 'transfer', 'give'] # keep everything lowercase count = 0 @@ -53,14 +62,6 @@ def extractAmount(text): return 'Too many' return returnval - -def extractMarker(text): - textList = text.split(' ') - for word in textList: - if word[-1] == '#': - return word - return False - def extractInitTokens(text): base_units = {'thousand':10**3 , 'million':10**6 ,'billion':10**9, 'trillion':10**12} textList = text.split(' ') @@ -91,7 +92,7 @@ def parse_flodata(string): 'amount': amount} elif isIncorp(cleanstring): incMarker = extractMarker(cleanstring) - initTokens = extractAmount(cleanstring) + initTokens = extractInitTokens(cleanstring) parsed_data = {'type': 'incorporation', 'flodata': string, 'marker': incMarker, 'initTokens': initTokens} else: parsed_data = {'type': 'noise'} diff --git a/templates/index.html b/templates/index.html index 8d30300..3860c7c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -25,6 +25,9 @@

marker : {{ parsed_data['marker'] }}

initTokens : {{ parsed_data['initTokens'] }}

{% endif %} + {% if parsed_data['type'] == 'noise' %} +

type : {{ parsed_data['type'] }}

+ {% endif %} {% endif %} ------------------