Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5f3a4edd7 | ||
|
|
83841ef6b2 | ||
|
|
ef7219a952 | ||
|
|
91d65a6bfb | ||
|
|
5581960eee | ||
|
|
5a6cabd3db | ||
|
|
a9ec303f3f | ||
|
|
47569f2ea6 | ||
|
|
c4953ca6cc | ||
|
|
ef7dce1375 | ||
|
|
1042ec90da | ||
|
|
36de0ae909 |
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/sentiment-analyser.iml" filepath="$PROJECT_DIR$/.idea/sentiment-analyser.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/sentiment-analyser.iml
generated
Normal file
9
.idea/sentiment-analyser.iml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
11
.idea/vcs.xml
generated
Normal file
11
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CommitMessageInspectionProfile">
|
||||
<profile version="1.0">
|
||||
<inspection_tool class="GraziCommit" enabled="true" level="TYPO" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@ -64,10 +64,10 @@ spec:
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
requests:
|
||||
cpu: 32m
|
||||
memory: 32Mi
|
||||
cpu: 64m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 75m
|
||||
cpu: 128m
|
||||
memory: 64Mi
|
||||
securityContext:
|
||||
capabilities:
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env groovy
|
||||
|
||||
env.APPLICATION_NAME = 'sentiment-analyser'
|
||||
env.APPLICATION_NAME = 'sentiment'
|
||||
env.APPLICATION_LABEL = 'utilities'
|
||||
env.GIT_BRANCH = 'master'
|
||||
env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}.git"
|
||||
env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}-analyser.git"
|
||||
env.GIT_REPOSITORY_URL = "https://${env.GIT_REPOSITORY_PATH}"
|
||||
env.GITHUB_CREDENTIALS_ID = 'Github'
|
||||
env.DIGITAL_OCEAN = 'registry.digitalocean.com'
|
||||
|
||||
12
src/main.py
12
src/main.py
@ -18,15 +18,20 @@ analyser = sentimentAnalyser.get_sentiment()
|
||||
@app.route('/sentiment', methods=['GET'])
|
||||
def tweetPredict():
|
||||
tweet = request.args.get('tweet')
|
||||
syncId = request.headers.get('X-CRYPTO-Sync-ID')
|
||||
|
||||
log("Receiving Tweet to classify {}".format(tweet), 'INFO')
|
||||
log("Receiving Tweet to classify [{}] for [{}]".format(tweet, syncId), 'INFO')
|
||||
|
||||
result = analyser.get_vader_sentiment(tweet)
|
||||
|
||||
log("Returning classification result of {}".format(result), 'INFO')
|
||||
log("Returning classification result of [{}]".format(result), 'INFO')
|
||||
|
||||
return json.dumps({'result': result, 'tweet': tweet}), 200, {'ContentType':'application/json'}
|
||||
|
||||
@app.route('/sentimentProbeTest', methods=['GET'])
|
||||
def sentimentProbeTest():
|
||||
return json.dumps({'result': {'Score': {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound': 0.0}, 'Compound': 0.0}, 'tweet': 'Fake Text'}), 200, {'ContentType':'application/json'}
|
||||
|
||||
def callSentimentAnalyser():
|
||||
analyser.set_newSentiment()
|
||||
|
||||
@ -38,10 +43,9 @@ def callProbes():
|
||||
if __name__ == '__main__':
|
||||
setup_logging()
|
||||
|
||||
log("Starting Spam Filter...", 'INFO')
|
||||
log("Starting Sentiment Analyser...", 'INFO')
|
||||
sys.stdout.flush()
|
||||
|
||||
Thread(target=callProbes).start()
|
||||
|
||||
Thread(target=callSentimentAnalyser).start()
|
||||
# Thread(target=callNewsFilter).start()
|
||||
@ -13,7 +13,7 @@ def health():
|
||||
@app.route('/readiness')
|
||||
def readiness():
|
||||
|
||||
result = requests.request("GET", 'http://0.0.0.0:9090/senitment?tweet=Boitcoin%20is%20doing%20very%20well')
|
||||
result = requests.request("GET", 'http://0.0.0.0:9090/sentimentProbeTest')
|
||||
result = json.loads(result.text)
|
||||
|
||||
if result != "" :
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user