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

Document how to load custom rulesets #82

Open
ssokolow opened this issue Jul 31, 2022 · 4 comments
Open

Document how to load custom rulesets #82

ssokolow opened this issue Jul 31, 2022 · 4 comments

Comments

@ssokolow
Copy link

I have a project where I'd prefer not to reinvent nlprule for applying my custom grammar rules (common validly-spelled typos I see in fanfiction), but the documentation is very unclear on how to do anything with custom rules.

  1. In a PyQt application, how do I specify files by path like with the Rust API?
  2. How do I go from the raw LanguageTool XML to the .bin files?
  3. Do I need to do multiple passes with different nlprule instances if I also want to check regular grammar stuff or is there a way to merge rulesets?
@bminixhofer
Copy link
Owner

nlprule currently is not very easily extensible w.r.t custom rules.

To answer (2) you can look at https://github.com/bminixhofer/nlprule/tree/main/build. The binaries are compiled from a directory containing all needed resources. You could add your rules to the grammar.xml in this directory and compile a new binary yourself.

@ssokolow
Copy link
Author

ssokolow commented Aug 1, 2022

That's fine in and of itself for now. I more intended this as a request for:

  1. A more obvious path to discover the existence of https://github.com/bminixhofer/nlprule/tree/main/build from the README or the docs.rs documentation.
  2. Clarification on whether "the nlprule binaries" refers to just the .bin files or also the build of the Rust code used in the Python distributables and, if the latter, how to minimize the amount of needless work done when the intent is just to generate from a replacement grammar.xml.
  3. Clear instructions on how to access the Rust version's path-taking APIs from the Python bindings, where the documentation covers letting it do path lookup for you.

...ideally all together in a single "How to customize the grammar rules" section.

@bminixhofer
Copy link
Owner

I agree, this should be improved.

To answer (2), I refer to the nlprule binaries as only the .bin files, not the build of the Rust code. But I see now where the confusion is coming from, maybe a different name would be better to refer to the LanguageTool data to avoid confusion.

@ssokolow
Copy link
Author

ssokolow commented Aug 2, 2022

You could just call them ".bin files". That'd work.

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

No branches or pull requests

2 participants