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

[MODULE] - Noun chunker/ splitter #384

Open
LeonardPuettmannKern opened this issue Oct 18, 2023 · 0 comments
Open

[MODULE] - Noun chunker/ splitter #384

LeonardPuettmannKern opened this issue Oct 18, 2023 · 0 comments
Labels
cognition enhancement New feature or request

Comments

@LeonardPuettmannKern
Copy link
Contributor

Please describe the module you would like to add to bricks
A brick that returns an embedding list containing only the nouns of a text, so that they can be used as pointers.

Do you already have an implementation?

ATTRIBUTE = "text" 

def noun_splitter(record):
    nouns_sents = []
    for sent in record[ATTRIBUTE].sents:
        nouns = [token.text for token in sent if token.pos_ == "NOUN" and len(token.text) > 1]
        if nouns:
            nouns_sents.extend([" ".join(nouns[i:i+1]) for i in range(0, len(nouns), 1)])
    return list(set(nouns_sents))

Additional context
Can be implemented with SpaCy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cognition enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant