quesurifn / yake-rust

MIT License
6 stars 5 forks source link

Add more args to Yake::new #8

Open bunny-therapist opened 4 weeks ago

bunny-therapist commented 4 weeks ago

Right now, there appears to be no way to change, e.g., the stop words.

xamgore commented 3 weeks ago

Have a branch for that, will PR a bit later.

xamgore commented 3 weeks ago

@bunny-therapist could you please test with my fork? Cargo.toml:

[patch.crates-io]
yake-rust = { git = "https://github.com/xamgore/yake-rust.git" }
bunny-therapist commented 3 weeks ago

I am going to try it, but first thing I notice is that I need to override everything in Config or nothing. It would be more useful to just be able to override some of it, and use defaults for other things.

bunny-therapist commented 3 weeks ago

I mean, I can get around it by creating the default config and carrying over some values. I did that now, and it appears to work.

I think it would be useful to have something like that in the Config class though. Like, a constructor that takes Option<...> of every field and then uses unwrap_or(default) for the fields.

xamgore commented 3 weeks ago

Yake implements Default trait which means you can do just Yake::default() or let yake: Yake = Default::default(). Config also implements Default.

let yake = Yake::new(Config {
  dedupe_lim: 0.99,
  ..Default::default()
});

That should be written in the documentary comments, of course.