Added fix for sorting Ratio
This commit is contained in:
parent
0b9f6cb216
commit
fff44a99bd
11
app.py
11
app.py
|
@ -158,13 +158,6 @@ def create_app():
|
|||
}
|
||||
if 'Absolute frequency in second treebank' in head:
|
||||
table_columns2displayed_table_columns['Absolute frequency'] = gettext('Frequency in A')
|
||||
# table_columns2displayed_table_columns['Absolute frequency in second treebank'] = gettext('Frequency in B')
|
||||
# if 'MI' in table_columns2displayed_table_columns:
|
||||
# del table_columns2displayed_table_columns['MI']
|
||||
# if 'logDice' in table_columns2displayed_table_columns:
|
||||
# del table_columns2displayed_table_columns['logDice']
|
||||
# if 't-score' in table_columns2displayed_table_columns:
|
||||
# del table_columns2displayed_table_columns['t-score']
|
||||
else:
|
||||
del table_columns2displayed_table_columns['Absolute frequency in second treebank']
|
||||
displayed_table_columns2table_columns = {v: k for k, v in table_columns2displayed_table_columns.items()}
|
||||
|
@ -176,9 +169,9 @@ def create_app():
|
|||
sort_id = head.index(order_by)
|
||||
if order_type == 'asc':
|
||||
# check if a number can be converted to float or int
|
||||
ordered_content = sorted(content[1:], key=lambda x: -1 * float(x[sort_id]) if x[sort_id].isnumeric() or re.match(r'^-?\d+(?:\.\d+)$', x[sort_id]) is not None else x[sort_id], reverse=True)
|
||||
ordered_content = sorted(content[1:], key=lambda x: -1 * float(x[sort_id]) if x[sort_id].isnumeric() or re.match(r'^-?\d+(?:\.\d+)$', x[sort_id]) is not None and order_by != 'Ratio' else x[sort_id], reverse=True)
|
||||
else:
|
||||
ordered_content = sorted(content[1:], key=lambda x: -1 * float(x[sort_id]) if x[sort_id].isnumeric() or re.match(r'^-?\d+(?:\.\d+)$', x[sort_id]) is not None else x[sort_id])
|
||||
ordered_content = sorted(content[1:], key=lambda x: -1 * float(x[sort_id]) if x[sort_id].isnumeric() or re.match(r'^-?\d+(?:\.\d+)$', x[sort_id]) is not None and order_by != 'Ratio' else x[sort_id])
|
||||
else:
|
||||
ordered_content = content[1:]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user