Natural Language Processing


Introduction

Language Processing or Natural Langugage Processing allow you to extract meaningful part of human language by the means of NLP algorithm.

nlp

Currently this api is only supported for ENGLISH language, but soon we will be adding multiple languages

Endpoint

Post
   https://api.oyyi.xyz/v1/ml/language-processing

Content-Type: application/json

Parameters

  • text Required

    • Type: string
    • Details: english language text is required to extract data.
  • param

    You can , seperated parameter to include during natural language processing. You can read about this in detail over google.
    • Type: label, lemma, pos, dep, is_stop, is_alpha, is_email, ent_type, ent_loc, morph
    • Default: default value is ent_type,pos,is_stop
  • remove_stop

    Stop words are those words which don't have any particular meaning inside the sentence
    • Type: boolean
    • Default: false

Example

Python
import requestsurl = $BASE_URL/ml/language-processingtoken = 'your_bearer_token_here'headers = {'Authorization': f'Bearer {token}'}data = { "text": 'i used to go for Taj mahal but now i dont go there.', "param": 'label,lemma,pos,dep,is_stop,is_alpha,is_email,ent_type,ent_loc,morph' };response = requests.post(url,params=data, headers=headers)print(response.text)
Javascript
const axios = require('axios');const url = $BASE_URL/ml/language-processing;const token = 'your_bearer_token_here';const data = { text: 'i used to go for Taj mahal but now i dont go there.', param: 'label,lemma,pos,dep,is_stop,is_alpha,is_email,ent_type,ent_loc,morph' };const config = {  headers: {    'Authorization': `Bearer ${token}`,    'Content-Type': 'application/json'  }};axios.post(url, data, config)  .then(response => console.log(response.data))  .catch(error => console.error(error));
Dart
import 'dart:io';import 'package:http/http.dart' as http;void main() async {   final url = Uri.parse('$BASE_URL/ml/language-processing');  final data ={ "text": 'i used to go for Taj mahal but now i dont go there.', "param": 'label,lemma,pos,dep,is_stop,is_alpha,is_email,ent_type,ent_loc,morph' }; final response = await http.post(    Uri.parse(url),    headers: {'Content-Type': 'application/json'},    body: jsonEncode(data),  );}
Laravel
use Illuminate\Http\Client\Response;use Illuminate\Support\Facades\Http;$url = '$BASE_URL/ml/language-processing';$token = 'your_bearer_token_here';$data = ["text" => 'i used to go for Taj mahal but now i dont go there.', "param" => 'label,lemma,pos,dep,is_stop,is_alpha,is_email,ent_type,ent_loc,morph' ];$response = Http::withHeaders([    'Authorization' => 'Bearer ' . $token,])->post($url,$data);if ($response->successful()) {    $data = $response->json();} else {m    $message = $response->json()['message']m;}
Curl
curl -X POST \  -H {'Authorization: Bearer your_bearer_token_here','Content-type: application/json'} \  -d { "text": 'i used to go for Taj mahal but now i dont go there.', "param": 'label,lemma,pos,dep,is_stop,is_alpha,is_email,ent_type,ent_loc,morph' } \  $BASE_URL/ml/language-processing

Response

Default
  {  "data": [    {      "text": "Taj",      "ent_type": "GPE",      "pos": "PROPN",      "is_stop": false    },    {      "text": "mahal",      "ent_type": "",      "pos": "NOUN",      "is_stop": false    },    {      "text": "nt",      "ent_type": "",      "pos": "PART",      "is_stop": false    },    {      "text": ".",      "ent_type": "",      "pos": "PUNCT",      "is_stop": false    }  ]}
Custom
{  "data": [    {      "text": "Taj",      "label": null,      "lemma": "Taj",      "pos": "PROPN",      "dep": "compound",      "is_stop": false,      "is_alpha": true,      "is_email": false,      "ent_type": "GPE",      "ent_loc": "B",      "morph": "Number=Sing"    },    {      "text": "mahal",      "label": null,      "lemma": "mahal",      "pos": "NOUN",      "dep": "pobj",      "is_stop": false,      "is_alpha": true,      "is_email": false,      "ent_type": "",      "ent_loc": "O",      "morph": "Number=Sing"    },    {      "text": "nt",      "label": null,      "lemma": "not",      "pos": "PART",      "dep": "neg",      "is_stop": false,      "is_alpha": true,      "is_email": false,      "ent_type": "",      "ent_loc": "O",      "morph": ""    },    {      "text": ".",      "label": null,      "lemma": ".",      "pos": "PUNCT",      "dep": "punct",      "is_stop": false,      "is_alpha": false,      "is_email": false,      "ent_type": "",      "ent_loc": "O",      "morph": "PunctType=Peri"    }  ]}