gkunter / coquery

Coquery is a free corpus query tool for linguists, lexicographers, translators, and anybody who wishes to search and analyse a text corpus.
GNU General Public License v3.0
18 stars 4 forks source link

Value substitution with functions fails #235

Closed gkunter closed 7 years ago

gkunter commented 7 years ago

When attempting to determine the unique values in order to populate the value substitution table, apparently the wrong column is selected in the underlying dataframe.

Test case: ALICE corpus with Word as output column and LENGTH(Word) as function. Selecting the function in the Column property dialog raises an exception.

gkunter commented 7 years ago

This bug is introduced by commit 604b078: the substitution table is now determined on the basis of the raw data frame prior to any management. Accordingly, functions have not been applied yet, and are therefore not available in the data frame.

gkunter commented 7 years ago

I don't see a straightforward solution to this yet. The problem is the execution order: the substitution table is applied by the data manager first, and only afterwards are the functions evaluated. It has to be this way because otherwise functions would not work on the substituted values. However, the Column properties dialog currently uses the raw data table (before substitutions) to look up the unique values that serve as substitution keys. It has to be this way because otherwise it would list the already substituted values as substitution keys.

One solution would be to store the unique values in the manager before substitution, and then pass these values to the Column properties dialog.