Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable template insertion should rely on spacy token indices, not str.replace #21

Open
jaidevd opened this issue Jan 20, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jaidevd
Copy link
Member

jaidevd commented Jan 20, 2020

From the README example,

the auto-gen template turns out to be:

{% set fh_args = {"_by": ["species"], "_c": ["sepal_width|avg"], "_sort": ["sepal_width|avg"]}  %}
{% set df = U.gfilter(orgdf, fh_args.copy()) %}
{% set fh_args = U.sanitize_fh_args(fh_args, orgdf) %}
{# Do not edit above this line. #}
The {{ df["{{ fh_args['_by'][0] }}"].iloc[0] }} {{ fh_args['_by'][0] }} has the least average sepal_width.

The "virginica" token turns out to be a nested template - the correct value is {{ df["species"].iloc[0] }}. But "species" itself is another variable (right the next word) with value {{ fh_args['_by'][0] }}, and therefore gets re-templatized. This is because templates are added in the source text with str.replace here.

They should instead be replaced by changing spacy tokens and forming new spacy docs.

@jaidevd jaidevd added the bug Something isn't working label Jan 20, 2020
@jaidevd jaidevd self-assigned this Jan 20, 2020
@jaidevd jaidevd added this to the IDE v0.1.3 Release milestone Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant