Skip to content

Commit 6dabf4f

Browse files
committed
readme update + returned back original py script for reference
1 parent 8db8045 commit 6dabf4f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ Disclaimer: this is my (very limited) understanding.
4848

4949
So... Looks like I have to [use python's main.c](https://github.com/pyinstaller/pyinstaller/pull/5801#issuecomment-833797956) in order to create portable python interpreter that I can ship with this package.
5050
But instead of running in console mode (and requiring to be ran using `spawn child process`), it'll be possible to embed NAPI into it, so it'll be a NodeJS package.
51+
52+
The most recent attempt to create such a portable python lives in [my cpython fork](https://github.com/Maxim-Mazurok/cpython/tree/vader).
53+
Currently it will run vader if you put `vaderSentiment-master` folder in the `cpython` root folder.
54+
55+
`PyRun_SimpleString` is the key function under the hood.

original.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import importlib
2+
SentimentIntensityAnalyzer = getattr(importlib.import_module(
3+
"vaderSentiment-master.vaderSentiment.vaderSentiment"), "SentimentIntensityAnalyzer")
4+
5+
6+
def print_sentiment_scores(sentence):
7+
analyser = SentimentIntensityAnalyzer()
8+
snt = analyser.polarity_scores(sentence)
9+
print(snt.get('compound'))
10+
11+
12+
print_sentiment_scores("Woohooo 😍 ✌️")

0 commit comments

Comments
 (0)