Skip to content

How to add new words for existing object? #39

Open
@gambastyle

Description

@gambastyle

Hi,
I really like this library, works very well.

I have 1.5 million names and each has at least 2-3 synonyms. It take 12 hours to create autocomplete object, after which I couldn't find a way to add new words and synonyms. Can you please advise?

Thanks!

Activity

changed the title [-]How to add new words for exisint object?[/-] [+]How to add new words for existing object?[/+] on Sep 29, 2022
seperman

seperman commented on Dec 9, 2022

@seperman
Owner

Hey @gambastyle
Sorry I didn't get back to you earlier.
I need to rewrite this library with Cython to be optimized for handling that size of input words. I have not had the time to do so. It is cool that you are pushing it to its limits!

bMorgan01

bMorgan01 commented on Apr 19, 2023

@bMorgan01

Sorry to revive this long-dead thread, but I have the same question.

My input size is no where near this big, but I still need to be able to update an existing object with new words/synonyms. In my case I've made an AutoComplete family of subclasses. Each different subclass will have a different set of words to choose from. Unfortunately it is not so simple as to set self.synonyms and self.words in the __init__ for a given subclass.

See this extremely simplified example:

from fast_autocomplete import AutoComplete

class Animal(AutoComplete):
    def __init__(self):
        super().__init__(dict())

        self.words = {"eat": {}, "sleep": {}, "drink": {}, "walk": {}}

class Dog(Animal):
    def __init__(self):
        super().__init__()

        self.words["bark"] = {}
        self.words["wag"] = {}

class Human(Animal):
    def __init__(self):
        super().__init__()

        self.words["code"] = {}
        self.words["file taxes"] = {}

Any ideas? Should I just rework what I have so the classes each have own their own instance AutoComplete with a different set of words?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @seperman@bMorgan01@gambastyle

        Issue actions

          How to add new words for existing object? · Issue #39 · seperman/fast-autocomplete