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

Problem with complex fix using paste + replace_all #278

Closed
TobiasNx opened this issue Jan 6, 2023 · 8 comments · Fixed by #281
Closed

Problem with complex fix using paste + replace_all #278

TobiasNx opened this issue Jan 6, 2023 · 8 comments · Fixed by #281
Labels
bug Something isn't working

Comments

@TobiasNx
Copy link
Collaborator

TobiasNx commented Jan 6, 2023

hbz/lobid-resources#1584

I have a complex fix that uses paste and replace_all besides others.
while the paste alone does not create the wrong transformation

Adding an replace_all function transforming the results of the pase seem to create an wrong output:

    "altLabel" : [ "Ev.-Luth. Landeskirche Sachsens ( )", "Evang.-Luth. Landeskirche Sachsens ( )", "EVLKS ( )", "Ev.-Luth. Landeskirche Sachsens ( )", "Evang.-Luth. Landeskirche Sachsens ( )", "EVLKS ( )" ],
    "$i" : {
      "altLabel" : [ {
        "1" : "Ev.-Luth. Landeskirche Sachsens",
        "2" : "Evang.-Luth. Landeskirche Sachsens",
        "3" : "EVLKS",
        "4" : "Ev.-Luth. Landeskirche Sachsens",
        "5" : "Evang.-Luth. Landeskirche Sachsens",
        "6" : "EVLKS"
      } ]
      ```

I use the combination with paste and replace_all at another place in the fix but there do not have the problem:
https://github.com/hbz/lobid-resources/pull/1584/commits/733286d2e1f6841f795650c57c18c166c453ce06
@TobiasNx TobiasNx changed the title Problem with complex paste + replace_all Problem with complex fix using paste + replace_all Jan 6, 2023
@TobiasNx TobiasNx added the bug Something isn't working label Jan 6, 2023
@blackwinter
Copy link
Member

blackwinter commented Jan 6, 2023

replace_all() seems to have issues with programmatically added values in arrays (not limited to paste()).

ETA: Also not limited to replace_all(), presumably all "string transformers" are affected.

@blackwinter
Copy link
Member

blackwinter commented Jan 6, 2023

Here are a bunch of test cases: e7ff7fd

@fsteeg: Can you look into fixing the path logic?

@TobiasNx: Do you want to try and supply an integration test for your use case?

@TobiasNx
Copy link
Collaborator Author

TobiasNx commented Jan 9, 2023

Is this also related to this problem: hbz/lobid-resources#1585?

Maybe it is related to this: #250 If we change stuff with replace_all perhaps we should take in mind the other problems

@blackwinter
Copy link
Member

Is this also related to this problem: hbz/lobid-resources#1585?

Yes.

Maybe it is related to this: #250

Doesn't look like it, but can't say for sure.

@fsteeg
Copy link
Member

fsteeg commented Jan 13, 2023

@fsteeg: Can you look into fixing the path logic?

I'll take a look, thanks for the unit tests!

fsteeg added a commit that referenced this issue Jan 13, 2023
Tweak test: add blank inserted by `paste` as default `join_char`
@fsteeg
Copy link
Member

fsteeg commented Jan 13, 2023

Pushed some tweaks in 87e30a7 and 416ba75, which seem to fix the use cases from the unit tests.

@TobiasNx TobiasNx self-assigned this Jan 16, 2023
TobiasNx added a commit that referenced this issue Jan 17, 2023
@TobiasNx
Copy link
Collaborator Author

I added my case here as integration test: #280

TobiasNx added a commit that referenced this issue Jan 17, 2023
TobiasNx added a commit that referenced this issue Jan 17, 2023
TobiasNx added a commit that referenced this issue Jan 17, 2023
@TobiasNx
Copy link
Collaborator Author

Tested my integration test it works in the new branch.

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

Successfully merging a pull request may close this issue.

3 participants