This repository has been archived by the owner on May 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Getting what you seek (1.0)
Percy Mamedy edited this page Mar 11, 2017
·
1 revision
Once the service has been created and data passed, you may retrieve the full Profile of the user using the getFullProfile()
method
//Create the service and pass in data
$insights = app()->make('PersonalityInsights')->addContentItems($dataToAnalyse);
//Get Full Profile
$profile = $insights->getFullProfile(); // Illuminate\Support\Collection
Instead of the full profile you can also retrieve a single InsightNode
. An InsightNode
contains information about a particular trait of the user, like Openness, Intellect, Conscientiousness and so on. See Reference.
An InsightNode
is basically an extended Collection
object with methods that helps calculating percentage for the particular trait contained within the node.
//Get the node
$openness = $insights->getInsight('Openness'); // FindBrok\PersonalityInsights\Support\DataCollector\InsightNode
//Calculate percentage
$percentage = $openness->calculatePercentage();
//Calculate error margin
$errorMargin = $openness->calculateErrorPercentage();
See TraitTreeNode for a full list of item contained within one InsightNode
The Traits node will be the data you will mostly focus on in you application but there are other data from the profile that you might be interested in retrieving.
//Get Word count
$insights->getWordCount();
//Get Source
$insights->getSource();
//Get Author or user whose profile is being analysed
$insights->getAuthor();
//Get Language in which the content was processed
$insights->getLanguage();
//Get the analysis level to determine if the analysis was strong or weak (This depends on word count, a word count of 3500 to 6000 is considered strong)
$insights->analysisLevel();
//You might prefer also these for determining analysis strength, these will return boolean
$insights->isAnalysisVeryStrong();
$insights->isAnalysisStrong();
$insights->isAnalysisWeak();
$insights->isAnalysisVeryWeak();