Skip to content

How to use the ML models #65

Open
Open
@sreevatsava-griddaluru

Description

@sreevatsava-griddaluru

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!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy