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

Whole new features #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stormbeforesunsetbee
Copy link

@stormbeforesunsetbee stormbeforesunsetbee commented Dec 8, 2022

What's new:

Example

Text: she's always arguing!

New:

{'fear': 0.0,
 'anger': 0.3333333333333333,
 'anticipation': 0.0,
 'trust': 0.3333333333333333,
 'surprise': 0.0,
 'positive': 0.0,
 'negative': 0.3333333333333333,
 'sadness': 0.0,
 'disgust': 0.0,
 'joy': 0.0}

Previous:

{'fear': 0.0,
 'anger': 0.0,
 'anticip': 0.0,
 'trust': 0.0,
 'surprise': 0.0,
 'positive': 0.0,
 'negative': 0.0,
 'sadness': 0.0,
 'disgust': 0.0,
 'joy': 0.0}

To see all of the possible expansions

# use the old version

def expand_synonyms(lex):
    from nltk.corpus import wordnet

    lex_ = {}

    for i in lex:
        for j in wordnet.synsets(i):
            for k in j.lemmas():
                word = k.name().replace('_', ' ')

                if not word in lex:
                    lex_[word] = lex[i]

    return lex_

expand_synonyms(nrc.lexicon)

@stormbeforesunsetbee stormbeforesunsetbee changed the title read from txt and actually expand lexicon from synonyms Whole new features Dec 11, 2022
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

Successfully merging this pull request may close these issues.

what about a negative particles before the word
1 participant