UNPKG

crowd-sentiment

Version:

javascript port of vader sentiment tool

103 lines (82 loc) 3.85 kB
/** * Copyright 2018 Comcast Cable Communications Management, LLC * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import {SentimentIntensityAnalyzer} from '../src/vaderSentiment'; let test = require('tape'); test('SentimentIntensityAnalyzer.polarity_scores match original demo output', t => { const expectedResults = [ { text: 'wrong', scores: {neg: 0.0, neu: 1.0, pos: 0.0, compound: 0.0} }, { text: 'This is a bug. I will fix it', scores: { neg: 0, neu: 0.667, pos: 0.333, compound: 0.3612 } }, { 'text': 'Engagement score is not working...', 'scores': { neg: 0, neu: 0.571, pos: 0.429, compound: 0.4588 } }, { 'text': 'Hey community builders, what do you think about the new Discord Forum Channels? Anyone trying it already?', 'scores': { neg: 0, neu: 1.0, pos: 0, compound: 0 } }, { text: `[C-116] Exclude team members from activities Opens detail view → choose which one is primary → merge (only 2!) Properly exclude team members from the app. Exclude them from: Activity feed (https://app.crowd.dev/activities) Activity tab on Home`, scores: { neg: 0, neu: 1, pos: 0, compound: 0 }, }, { text: `[C-176] Reports issues From Discord The button is covered by widgets (see issue) Infinite loading when we have a graph and we select an order by Unclear what kind of values can be inputted here in the line graph widget in reports Unclear what the ordering is enabling you to do as well Loom https://www.loom.com/share/95674b7e9893402caa81c18647045572 Loom (#2) https://www.loom.com/share/6cb4499f6d424c4690d1b1f60cdcb015 From SyncLinear.com | C-176`, scores: { neg: 0.047, neu: 0.882, pos: 0.071, compound: 0.3626 }, }, { text: `[C-269] Auto-set email address of user as "name" to avoid empty field Problem Some users in our crowd.dev prod workspace don't have a user name. It's currently also not possible to change them for others (every user has to go to https://app.crowd.dev/auth/edit-profile for that). The problem is that e.g. assigning tasks doesn't work when there is no user name: Solution Auto-set the email address of the user as the name as long as users didn't add their name manually. From SyncLinear.com | C-269`, scores: { neg: 0.04, neu: 0.933, pos: 0.028, compound: -0.0026 }, }, { text: `[C-400] Hide bot activity It is already done in reports. We need to hide it from the homepage and activity section. Same as team members. From SyncLinear.com | C-400`, scores: { neg: 0, neu: 1, pos: 0, compound: 0 }, }, { text: `Is there a way to move the Open Community Help Center under the company's domain, so that we can get that SEO 🥤?`, scores: { neg: 0, neu: 0.81, pos: 0.19, compound: 0.5719 }, } ]; for (let i = 0; i < expectedResults.length; i++) { const input = expectedResults[i].text; const expectedOutput = expectedResults[i].scores; const result = SentimentIntensityAnalyzer.polarity_scores(input); t.deepEqual(result, expectedOutput, input); } t.end(); });