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

How to use the ML models #65

Open
Sreevatsava1 opened this issue Aug 11, 2022 · 0 comments
Open

How to use the ML models #65

Sreevatsava1 opened this issue Aug 11, 2022 · 0 comments

Comments

@Sreevatsava1
Copy link

I can see that I can use the ML classifier to identify the definitions from the code.
File - lexnlp.extract.en.definitions

def get_definitions(text: str,
                    return_sources=False,
                    decode_unicode=True,
                    return_coords=False,
                    locator_type: AnnotationLocatorType = AnnotationLocatorType.RegexpBased) -> Generator:
    """
    Find possible definitions in natural language in text.
    The text will be split to sentences first.
    :param return_coords: returns a (x, y) tuple in each record. x - definition's text start, y - definition's text end
    :param decode_unicode:
    :param return_sources: returns a tuple with the extracted term and the source sentence
    :param text: the input text
    :param locator_type: use default (Regexp-based) or ML-based locator
    :return: Generator[name] or Generator[name, text] or Generator[name, text, coords]
    """

So I've tried giving the 'locator_type' as AnnotationLocatorType.MlWordVectorBased for the get_definitions() function, then I'm getting this error.

"parser_ml_classifier" object should be initialized (call load_compressed method)

I've gone through the definitions file and I can see this in line 43
parser_ml_classifier = LayeredDefinitionDetector()

I tried to run the load_compressed method inside the LayeredDefinitionDetector() but it is asking for a file_path and I don't understand which file path should be given. Am I missing something, could anyone guide me on how to use the ML models for definitions? Thanks!!

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

No branches or pull requests

1 participant