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

Is there a way to save and reload the model? #8

Open
lingvisa opened this issue Sep 22, 2022 · 1 comment
Open

Is there a way to save and reload the model? #8

lingvisa opened this issue Sep 22, 2022 · 1 comment

Comments

@lingvisa
Copy link

@znwang25 Nice to see this package. I haven't found another fuzzy matching library that works well for Chinese. Can the model generated by fit() be saved and reloaded? Also ,do you have evaluation of the overall quality of this library? Thanks for the info.

@znwang25
Copy link
Owner

Hi @lingvisa ,
Thanks for using this package.

Can the model generated by fit() be saved and reloaded?

Currently, there is no direct interface for saving and loading a model. But it's a good point, I may add it in the next update.
In the meantime, I think you can just use pickle to save the FCM object.

# fcm = FuzzyChineseMatch(ngram_range=(3, 3), analyzer='stroke')
# fcm.fit(test_dict)

# Saving the model
with open('model.pkl', 'wb') as outp:
    pickle.dump(fcm, outp)

# Loading the saved model
with open('model.pkl', 'rb') as inp:
    fcm1 = pickle.load(inp)

Do you have evaluation of the overall quality of this library.

No. But I plan to add this in the future.

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