mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Updated pretrained script
This commit is contained in:
+16
-2
@@ -21,7 +21,15 @@ CREATE OR ALTER PROCEDURE [dbo].[get_sentiment]
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @script nvarchar(max);
|
||||
|
||||
|
||||
--Check that text is not empty
|
||||
IF NULLIF(@text, '') is null
|
||||
BEGIN
|
||||
THROW 50001, 'Please specify a text value to be analyzed.', 1;
|
||||
RETURN
|
||||
END
|
||||
|
||||
|
||||
--The Python script we want to execute
|
||||
SET @script = N'
|
||||
import pandas as p
|
||||
@@ -53,6 +61,12 @@ GO
|
||||
|
||||
--******************************************************************************************************************
|
||||
-- STEP 2 Execute the stored procedure to get sentiment of your own text
|
||||
--The below examples test a negative and a positive review text
|
||||
--******************************************************************************************************************
|
||||
EXECUTE [dbo].[get_sentiment] N'ENTER YOUR OWN TEXT HERE';
|
||||
-- Negative review
|
||||
EXECUTE [dbo].[get_sentiment] N'These are not a normal stress reliever. First of all, they got sticky, hairy and dirty on the first day I received them. Second, they arrived with tiny wrinkles in their bodies and they were cold. Third, their paint started coming off. Fourth when they finally warmed up they started to stick together. Last, I thought they would be foam but, they are a sticky rubber. If these were not rubber, this review would not be so bad.';
|
||||
GO
|
||||
|
||||
--Positive review
|
||||
EXECUTE [dbo].[get_sentiment] N'These are the cutest things ever!! Super fun to play with and the best part is that it lasts for a really long time. So far these have been thrown all over the place with so many of my friends asking to borrow them because they are so fun to play with. Super soft and squishy just the perfect toy for all ages.'
|
||||
GO
|
||||
Reference in New Issue
Block a user