Extraction of named entities from unstructured contextual data such as names, locations, brands, etc. is helpful when it comes to analysis. With the help of our efficient Name Entity Recognition, extracting these entities from articles is faster.
https://api.textrics.ai/ner_file_analysis.php
We support POST method to communicate with API.
1. dataset - This parameter is required
This is the upload file name which you wish to send to application to analyse.
2. api_key - This parameter is required
This is used to identify the user and the active subscription plan.
3. api_token - This parameter is required
This is used to authenticate the above user account.
4. language - This parameter is required
This is used to detect language of sentence in file.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$cfile = new CURLFile( // input file containing text //
$_FILES['dataset']['tmp_name'],
$_FILES['dataset']['type'],
$_FILES['dataset']['name']
);
$apiUrl = 'https://api.textrics.ai/ner_file_analysis.php'; // API URL //
$args['language'] = $_POST['language']; // Pass language used in file//
$args['dataset'] = $cfile; // pass uploaded file object //
$args['col_name'] = $_POST['col_name']; // Pass Column Name used in file//
$args['api_key'] = 'A32NBK55K3'; // user specific key to validate the account //
$args['api_token'] = 'P4lwpqT0YZYSVefSh44ADkvlJ8pesZDI'; // respective token to validate user credentials //
$args['col_name'] = $_POST['col_name']; // Pass Column Name used in file//
$options=[
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $args,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => ['Content-Type: multipart/form-data']
];
$ch = curl_init($apiUrl);
curl_setopt_array($ch, $options);
$response1 = curl_exec($ch);
echo $err = curl_error($ch);
curl_close($ch);
$response = json_decode($response1,true); // API output is stored in $response variable //
}
?>
if(!empty($response))
{
echo "<br/>";
echo "Response";
echo "<br/>";
echo "<pre style='text-align:left;'>";
print_r($response); // Printing the $response output on page //
echo "</pre>";
}
if(!empty($message))
{
echo $message;
}
?>
The response is structured in JSON as follows:
Array ( [response] => 1 [data] => Array ( [0] => Array ( [Sentence] => Our track record in developing innovations that are valued by the market is poor. We spend too much time talking about our previous wins (innovations that were developed many years ago, sometimes over a decade ago). There are often too many opinions / gatekeepers, design (of value propositions, pricing approach and sometimes even feature set) by committee is prevalent. Highly collaborative / "No blame" culture has all but eliminated individual accountability on a major project level. [Prediction] => Array ( [0] => Array ( [0] => many years ago [1] => DATE [2] => Absolute or relative dates or periods ) [1] => Array ( [0] => a decade ago [1] => DATE [2] => Absolute or relative dates or periods ) ) ) [1] => Array ( [Sentence] => I am not aware of "cost to serve" models that have been developed; believe we could gain valuable information on if we spent some time truly understanding the direct costs by customer type to better direct human resources, financial resources, time and energy. [Prediction] => ) [2] => Array ( [Sentence] => We have a significant weakness with large-scale production single family Builders, relative to our main facing competition - Moen This hurts us overall as the Single Family Builder market has been particularly strong as of late. [Prediction] => Array ( [0] => Array ( [0] => Single Family Builder [1] => ORG [2] => Companies, agencies, institutions, etc. ) ) ) [3] => Array ( [Sentence] => Areas to improve: understanding the Pro segment who shops at retail. [Prediction] => ) [4] => Array ( [Sentence] => We would benefit from a more cohesive company pricing strategy. The segments are empowered to make these decisions, and they can be rather siloed as a result. [Prediction] => ) [5] => Array ( [Sentence] => While we address customer segments effectively we do not effectively bridge these segments which can create channel conflict. [Prediction] => ) [6] => Array ( [Sentence] => I believe we look at the business segments and develop strategies around trade and retail. However, in trade there are many segments. We develop programs and products for "all trade". The market is very different for hospitality or urban high rise compared to what the homeowner wants through the showroom for their personal space. We don't have capabilities to have that flexibility. Our design team is amazingly talented but they are designing for the entire organization and we see too many similarities in design from one segment to the other (retail and trade overlap in particular) [Prediction] => ) [7] => Array ( [Sentence] => I would challenge at times the in depth view of our customer views. [Prediction] => ) [8] => Array ( [Sentence] => A challenge I see is overlapping brands competing for the same business, and at times, driving the decision down to price...in essence, commoditizing our own products. I also see efforts in the field creating a mash-up of the brands, diluting the value each brings to the customer. [Prediction] => ) ) [message] => success )
Code | Interpretation |
---|---|
1 | Success |
Exception Codes | |
10 | Authentication Exception |
11 | Invalid Input Exception |
12 | Language Exception |
13 | File Format Error |
14 | Request Timeout |
15 | Column Name Mismatch |
99 | Other Exception |