Neticle Wiki

Megmutatjuk mit gondol a Web!

Felhasználói eszközök

Eszközök a webhelyen


semantic_api_v1.0

Különbségek

A kiválasztott változat és az aktuális verzió közötti különbségek a következők.

Összehasonlító nézet linkje

Előző változat mindkét oldalon Előző változat
Következő változat
Előző változat
semantic_api_v1.0 [2015/06/21 12:16]
szekerespeter [Sample call]
semantic_api_v1.0 [2016/07/08 22:37] (aktuális)
szekerespeter [Response explanation]
Sor 7: Sor 7:
 ^Version ^Description ^ ^Version ^Description ^
 |v1.0 | Initial internal version, created by Peter Szekeres on 2015.06.21.| |v1.0 | Initial internal version, created by Peter Szekeres on 2015.06.21.|
 +
 +===== Changelog =====
 +Compared to v0.1:
 +  * user_key parameter renamed to token
 +  * input_text is not an array of text but one text
 +  * entity recognition and analysis introduced so the response structure was redesigned: ​
 +    * entities and opinion are ecognized
 +    * mentioning sentences are shown
 +    * relations between entitis are shown
 +  * the range of recognized entities and labels is broadened with: hr, medical, legal and business topics and events
 +  * there are less parameters to set for a request
 + 
  
 ===== Text Analysis ===== ===== Text Analysis =====
Sor 59: Sor 71:
 | stem| whether to include the stemmed format of the original 'input text' within the API response.\\ \\ Possible values:\\ 1 - enabled\\ 0 - disabled (default)\\ \\ (optional parameter) | | stem| whether to include the stemmed format of the original 'input text' within the API response.\\ \\ Possible values:\\ 1 - enabled\\ 0 - disabled (default)\\ \\ (optional parameter) |
 | lang_check| whether to check that the original 'input text' is aligned with the **lang** parameter.\\ \\ Possible values:\\ 1 - enabled\\ 0 - disabled (default)\\ \\ (optional parameter) | | lang_check| whether to check that the original 'input text' is aligned with the **lang** parameter.\\ \\ Possible values:\\ 1 - enabled\\ 0 - disabled (default)\\ \\ (optional parameter) |
-| format| desired API output format\\ \\ Possible values:\\ json (default)\\ ​csv\\ \\ (optional parameter) |+| format| desired API output format\\ \\ Possible values:\\ json (default)\\ ​\\ (optional parameter) | 
 +| call_id| a special id to help to track calls for different topics\\ \\ Possible values:\\ any string shorter than 255 characters\\ \\ (optional parameter) | 
 +| replace_accent| whether to remove letter accents from the input text or not \\ \\ Possible values:\\ 1 - enabled\\ 0 - disabled (default)\\ \\ (optional parameter) |
  
 ==== Sample call ==== ==== Sample call ====
Sor 73: Sor 87:
 { {
     "​recognized_negative_phrases":​ [],     "​recognized_negative_phrases":​ [],
-    "entites": [+    "call_id":"​keywordname",​ 
 +    "​entities": [
         {         {
             "​related_pos_phrases":​ [             "​related_pos_phrases":​ [
                 {                 {
-                    "name": "egy jó gyors",​+                    "phrase": "egy jó gyors",​
                     "​related_mention_number":​ 1                     "​related_mention_number":​ 1
                 },                 },
                 {                 {
-                    "name": "​kényelmes",​+                    "phrase": "​kényelmes",​
                     "​related_mention_number":​ 1                     "​related_mention_number":​ 1
                 }                 }
Sor 104: Sor 119:
             "​related_pos_phrases":​ [             "​related_pos_phrases":​ [
                 {                 {
-                    "name": "egy jó gyors",​+                    "phrase": "egy jó gyors",​
                     "​related_mention_number":​ 1                     "​related_mention_number":​ 1
                 },                 },
                 {                 {
-                    "name": "​kényelmes",​+                    "phrase": "​kényelmes",​
                     "​related_mention_number":​ 1                     "​related_mention_number":​ 1
                 }                 }
Sor 141: Sor 156:
             "​related_pos_phrases":​ [             "​related_pos_phrases":​ [
                 {                 {
-                    "name": "​kényelmes",​+                    "phrase": "​kényelmes",​
                     "​related_mention_number":​ 1                     "​related_mention_number":​ 1
                 }                 }
Sor 157: Sor 172:
                 }                 }
             ],             ],
-            "entity_opinion_index":​ 5, +            "phrase": "egy jó gyors",​
-            "name": "egy jó gyors",​+
             "​mention_number":​ 1,             "​mention_number":​ 1,
-            "​type":​ "​pos_phrase",​ 
             "​mentions":​ [             "​mentions":​ [
                 " ez egy jó gyors és kényelmes autó"                 " ez egy jó gyors és kényelmes autó"
Sor 169: Sor 182:
             "​related_pos_phrases":​ [             "​related_pos_phrases":​ [
                 {                 {
-                    "name": "egy jó gyors",​+                    "phrase": "egy jó gyors",​
                     "​related_mention_number":​ 1                     "​related_mention_number":​ 1
                 }                 }
Sor 185: Sor 198:
                 }                 }
             ],             ],
-            "entity_opinion_index":​ 5, +            "phrase": "​kényelmes",​
-            "name": "​kényelmes",​+
             "​mention_number":​ 1,             "​mention_number":​ 1,
-            "​type":​ "​pos_phrase",​ 
             "​mentions":​ [             "​mentions":​ [
                 " ez egy jó gyors és kényelmes autó"                 " ez egy jó gyors és kényelmes autó"
Sor 205: Sor 216:
  
 ^Element ^ Description ^ ^Element ^ Description ^
 +|entities | Recognized labels and entities (topics, attributes, brands, locations, etc. \\ \\ (If synonyms are set as parameters, only the labels, entities and phrases related to the target synonyms are recognized. If no synonyms set then every label, entity and phrase is recognized in the text.) |
 +|entity_name| The name of the entity. |
 +|entity_opinion_index| The quantified opinion related to the entity. |
 +|entity_type| The type of the entity: topic, event, person, brand, attribute, location, etc. |
 +|html_formatted_text| The HTML and CSS formatted text. \\ \\ If a sentence part contains a synonym it is surrounded by //​contain_keyword//​ class span tag. \\ \\ Recognized phrases are surrounded by //​polarity_item//​ class span tags.\\ \\ Recognized synonyms are surrounded by //synonym// class span tags.  |
 |keyword_stats | Number of keyword and synonym mentions. | |keyword_stats | Number of keyword and synonym mentions. |
-|total_keyword_hit_number ​| Number of the target ​entity ​was mentioned in the input textsEvery synonym hit is countedIf no synonym ​is set the result is 0. | +|mention_number ​| Number of separate ​entity ​mentions
-|total_synonym_hit_numbers ​Number of synonym mentions by each synonym. |+|mentions | Relevant sentences of entity mentions
 +|opinion_index | A score that represents how positive or negative ​is the text. means neutral opinion, while negative value means negative opinion and positive value means positive opinion. | 
 +|phrase ​The phrase recognized. |
 |processing_time_in_ms | The time needed to process the request. | |processing_time_in_ms | The time needed to process the request. |
-|analyzed_text_array | The array of the sent texts. If multiple texts should be analyzed by the same settings, they can be sent in blocks to the server, and the results are shown for each text in this array. | 
 |recognized_negative_phrases | Negative phrases recognized in the text. \\ \\ (If synonyms are set, only the negative ​ phrases related to the synonyms are recognized. If no synonyms set then every negative phrase is recognized in the text.) | |recognized_negative_phrases | Negative phrases recognized in the text. \\ \\ (If synonyms are set, only the negative ​ phrases related to the synonyms are recognized. If no synonyms set then every negative phrase is recognized in the text.) |
-|recognized_synonyms | Synonyms recognized in the text. | 
 |recognized_positive_phrases | Positive phrases recognized in the text.  \\ \\ (If synonyms are set, only the positive phrases related to the synonyms are recognized. If no synonyms set then every positive phrase is recognized in the text.) | |recognized_positive_phrases | Positive phrases recognized in the text.  \\ \\ (If synonyms are set, only the positive phrases related to the synonyms are recognized. If no synonyms set then every positive phrase is recognized in the text.) |
-|attribute_labels ​Recognized service and product attributes. \\ \\ (If synonyms are set, only the labels ​related to the synonyms are recognized. If no synonyms set then every label is recognized in the text.+|related_neg_phrases ​Negative phrases ​related to the entity. | 
-|location_labels ​Recognized locations. \\ \\ (If synonyms are set, only the labels related to the synonyms are recognized. If no synonyms set then every label is recognized ​in the text.)+|related_mention_number ​The number of how many times mentioned together with the entity ​in the same sentence. | 
-|opinion_index ​A score that represents how positive or negative is the text. 0 means neutral opinion, while negative value means negative opinion and positive value means positive opinion. | +|related_pos_phrases ​Positive phrases related to the entity 
-|topic_labels ​Recognized topics. \\ \\ (If synonyms are set, only the labels related to the synonyms are recognized. If no synonyms set then every label is recognized in the text.)+|recognized_synonyms ​Synonyms ​recognized in the text. | 
-|brand_labels ​Recognized brands. \\ \\ (If synonyms are set, only the labels related to the synonyms are recognized. If no synonyms set then every label is recognized in the text.)| +|total_keyword_hit_number ​Number of the target entity was mentioned in the input texts. Every synonym hit is counted. If no synonym ​is set the result ​is 0. | 
-|emotion_labels| Recognized emotions. \\ \\ (If synonyms are set, only the labels related to the synonyms are recognized. If no synonyms set then every label is recognized in the text.)+|total_synonym_hit_numbers ​Number of synonym ​mentions ​by each synonym. | 
-|analyzed_textThe HTML and CSS formatted text. \\ \\ If a sentence part contains a synonym ​it is surrounded by //​contain_keyword//​ class span tag. \\ \\ Recognized phrases are surrounded by //​polarity_item//​ class span tags.\\ \\ Recognized synonyms are surrounded ​by //synonym// class span tags +|call_id ​A special id to help to track calls for different topics ​|
-|organization_labelsRecognized organizations. \\ \\ (If synonyms are set, only the labels related ​to the synonyms are recognized. If no synonyms set then every label is recognized in the text.)| +
-|person_labels| Recognized persons. \\ \\ (If synonyms are set, only the labels related ​to the synonyms are recognized. If no synonyms set then every label is recognized in the text.)|+
  
 ==== Error codes ==== ==== Error codes ====
  
 ^Error code ^Error message ^ ^Error code ^Error message ^
 +|0 |IP address is blacklisted |
 |1 |No lang parameter set | |1 |No lang parameter set |
 |2 |Incorrect lang value | |2 |Incorrect lang value |
-|3 |No user_key ​parameter set | +|3 |No token parameter set | 
-|4 |Incorrect ​user_key ​value |+|4 |Incorrect ​token value |
 |5 |Incorrect input_text value | |5 |Incorrect input_text value |
-|6 |Incorrect synonyms value | +|6 |Incorrect synonyms value |
-|7 |Incorrect ​labeling ​value | +|7 |Incorrect ​stem value | 
-|8 |Incorrect ​sentiment_analysis ​value | +|8 |Incorrect ​lang_check ​value | 
-|9 |Incorrect ​opinion_index ​value | +|9 |Incorrect ​format ​value | 
-|10 |Incorrect ​stem value | +|10|Incorrect ​replace_accent ​value|
-|11 |Incorrect lang_check value | +
-|12 |No format parameter set | +
-|13 |Incorrect format ​value |+
 |unknown |Unknown exception | |unknown |Unknown exception |
 ===== Gender By Name ===== ===== Gender By Name =====
Sor 267: Sor 279:
 </​code>​ </​code>​
  
-==== Sample Java call ==== 
  
-<​code>​ 
-import java.io.InputStream;​ 
-import org.apache.commons.httpclient.HttpClient;​ 
-import org.apache.commons.httpclient.methods.PostMethod;​ 
- 
- 
-public class PostRequest { 
-    public static void main(String[] args){ 
-        String url = "​https://​semanticapi.neticle.hu/​0.1/​get_gender_from_name";​ 
-        InputStream in = null; 
- 
-        try { 
-            HttpClient client = new HttpClient();​ 
-            PostMethod method = new PostMethod(url);​ 
- 
-            //Add parameters 
-            method.addParameter("​user_key",​ "​demokey2"​);​ 
-            method.addParameter("​lang",​ "​hu"​);​ 
-            method.addParameter("​name",​ "​Lajos"​);​ 
-            method.addParameter("​format",​ "​json"​);​ 
- 
-            int statusCode = client.executeMethod(method);​ 
- 
-            if (statusCode != -1) { 
-                in = method.getResponseBodyAsStream();​ 
-            } 
- 
-            System.out.println(in);​ 
- 
-        } catch (Exception e) { 
-            e.printStackTrace();​ 
-        } 
- 
-    } 
-} 
-</​code>​ 
- 
-==== Sample JQuery AJAX call ==== 
- 
-<​code>​ 
-$.ajax({ 
-     url: '​https://​semanticapi.neticle.hu/​0.1/​get_gender_from_name',​ 
-     ​async:​ true, 
-     ​dataType:​ "​json",​ 
-     type: '​POST',​ 
-     ​contentType:​ '​application/​x-www-form-urlencoded;​charset=UTF-8',​ 
-     data: { lang: "​hu",​ name: "​Lajos",​ user_key="​demokey2",​ format="​json"​ }, 
-     ​success:​ function(data){ 
-         //​Process response JSON object 
-     } 
-     ​error:​ function(e){ 
-         ​console.log('​semantic api call failed: ' + e); 
-     } 
-}); 
-</​code>​ 
  
 ==== Sample response ==== ==== Sample response ====
semantic_api_v1.0.1434881787.txt.gz · Utolsó módosítás: 2015/06/21 12:16 szerkesztette: szekerespeter