共用方式為


getSentiment:Machine Learning 情感分析器轉換

對自然語言文字進行評分,並建立包含文字中情緒為正面之機率的資料行。

使用方式

  getSentiment(vars, ...)

引數

vars

要轉換的字元向量或變數名稱清單。 如已命名,則名稱代表要建立的新變數名稱。

...

傳送至計算引擎的其他引數。

詳細資料

getSentiment 轉換會傳回自然文字情感為正面的機率。 目前僅支援
英文。

定義轉換的 maml 物件。

作者

Microsoft Corporation Microsoft Technical Support

另請參閱

rxFastTreesrxFastForestrxNeuralNetrxOneClassSvmrxLogisticRegressionrxFastLinear

範例


 # Create the data
 CustomerReviews <- data.frame(Review = c(
   "I really did not like the taste of it",
   "It was surprisingly quite good!",
   "I will never ever ever go to that place again!!"),
   stringsAsFactors = FALSE)

 # Get the sentiment scores
 sentimentScores <- rxFeaturize(data = CustomerReviews, 
                                mlTransforms = getSentiment(vars = list(SentimentScore = "Review")))

 # Let's translate the score to something more meaningful
 sentimentScores$PredictedRating <- ifelse(sentimentScores$SentimentScore > 0.6, 
                                           "AWESOMENESS", "BLAH")

 # Let's look at the results
 sentimentScores