Skip to content

Instantly share code, notes, and snippets.

View jayantkodwani's full-sized avatar
🏠
Working from office

Jayant Kodwani jayantkodwani

🏠
Working from office
View GitHub Profile
# -*- coding: utf-8 -*-
"""
Spyder Editor
INTRODUCTION
This is a script file to perform the following operations:
1.Use Microsoft Azure Computer vision Cognitive service to extract text from images (OCR) stored on Blob storage or any link.
2.Export the extracted text to an MS Excel file on your desktop for further analysis
pip install --upgrade azure-cognitiveservices-vision-computervision
@jayantkodwani
jayantkodwani / Key-phrase extraction and Integration in Power BI
Last active February 28, 2021 15:07
Key-phrase extraction and Integration in Power BI
"""
@author: Jayant Kumar Kodwani
"""
# 'dataset' holds the input data for this script
import RAKE
import pandas as pd
"""Add stopwords list, REPLACE path as required"""
@jayantkodwani
jayantkodwani / DAX
Created February 20, 2021 20:56
DAX Code to create single column for sentiments
Overall Sentiment = IF(Responses[Sentiment.positive]=1,"Positive",IF(Responses[Sentiment.neutral]=1,"Neutral",IF(Responses[Sentiment.negative]=1,"Negative","NA")))
@jayantkodwani
jayantkodwani / Sentiment Analysis Azure API M query.txt
Last active February 20, 2021 18:34
Sentiment Azure API (M Query for PBI Custom Function)
= (text) => let
apikey = "<<Replace your APIKey here>>",
endpoint = "<<Replace your endpoint link here>>",
jsontext = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
jsonbody = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
bytesbody = Text.ToBinary(jsonbody),
headers = [#"Ocp-Apim-Subscription-Key" = apikey],
bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
jsonresp = Json.Document(bytesresp),
sentiment = jsonresp[documents]{0}[confidenceScores]