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

support for number-like strings #16

Merged
merged 1 commit into from
Feb 24, 2024
Merged

Conversation

tmcdonnell87
Copy link
Contributor

Issue #


What is the current behavior?

Strings that begin with a number and contain number-like characters (e.g., 10-20, 1.1.1) are not successfully parsed

What is the new behavior?

They are! :-)

Does this introduce a breaking change?

  • Yes
  • [X ] No

Other information

See tests

@mangiucugna mangiucugna merged commit 9c9ccfd into mangiucugna:main Feb 24, 2024
6 checks passed
@mangiucugna
Copy link
Owner

Thanks a lot! I will release 0.9.0 now

@mezka
Copy link

mezka commented Apr 18, 2024

Can we, instead of just returning the string, have a function like lambda ctx: ctx['str'] that receives the parser context and returns the string, but that by default we can replace from the main json_repairs interface.

def my_custom_value_error_repair(parser_context):
   parser_context.str = 'I COULD HAVE REPAIRED THIS STRING HERE BUT I DIDNT'

repaired_json = json_repair(my_json, on_parse_number_value_error=my_custom_value_error_repair)

That way if my dataset has an specific error that repeats itself I can make a custom formatter to save that error.

Also depending on how much context is passed we can have an LLM try to solve the error for us.

@mezka
Copy link

mezka commented Apr 18, 2024

I'm the author of https://github.com/mezka/afipcaeqrdecode, a utility function that deals with extract and decoding government issued metadata on Argentine Invoices that depends on json_repairs

@mangiucugna
Copy link
Owner

@mezka I am not 100% clear what behavior you would expect exactly.
Can you open a new issue and maybe put some examples including a sample json and expected output?
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants