{"__v":0,"_id":"55abc1cc63a6b60d006616f4","category":{"__v":21,"_id":"55a7aee94a33f92b00b7a154","pages":["55a7aee94a33f92b00b7a156","55a7ea403efe0c2f0074cb75","55a80eb23ec2ec0d00bd66ea","55a811fc6e61e619004f703e","55a8c513cf45e1390093f18c","55a8d9fa27a17d210052516d","55a8f048cf45e1390093f248","55aba4ba63a6b60d006616e1","55abab0a0685ce0d0049fb8d","55abb04da36ccd0d00fdebc1","55abc1cc63a6b60d006616f4","55abcdbd63a6b60d006616fa","55abd36763a6b60d00661700","55abd50ea36ccd0d00fdebdb","55abd8c3a36ccd0d00fdebdf","55abd9cc0685ce0d0049fbb5","55abdb6b63a6b60d00661706","55abdc9b0685ce0d0049fbb8","55c1f5fca131980d005be95b","55fac407bc972f0d0005f644","569f68e766a5640d00efa52d"],"project":"55a7aee84a33f92b00b7a150","version":"55a7aee84a33f92b00b7a153","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-16T13:17:29.102Z","from_sync":false,"order":2,"slug":"endpoints","title":"Endpoints"},"editedParams":true,"editedParams2":true,"parentDoc":null,"project":"55a7aee84a33f92b00b7a150","user":"55a7ae50bf1be93100d89df1","version":{"__v":6,"_id":"55a7aee84a33f92b00b7a153","project":"55a7aee84a33f92b00b7a150","createdAt":"2015-07-16T13:17:28.411Z","releaseDate":"2015-07-16T13:17:28.411Z","categories":["55a7aee94a33f92b00b7a154","55a7fefa3efe0c2f0074cbdf","55a8fb10c8bd450d000dd130","55a936b1cf45e1390093f362","55abddeaa36ccd0d00fdebe1","5624db675a86b423009462e1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-19T15:27:08.435Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"curl","code":"curl https://api.aylien.com/api/v1/classify/unsupervised \\\n   -H \"X-AYLIEN-TextAPI-Application-Key: [[app:key]]\" \\\n   -H \"X-AYLIEN-TextAPI-Application-ID: [[app:id]]\" \\\n   -d class=\"technology\" \\\n   -d class=\"sports\" \\\n   -d url=\"http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile\" "},{"code":"textapi.unsupervisedClassify({\n  url: 'http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile',\n  class: ['sports', 'technology']\n}, function(error, response) {\n  if (error === null) {\n    response.classes.forEach(function(c) {\n      console.log(c);\n    });\n  }\n});","language":"javascript"},{"code":"classes = ['technology', 'sports']\nurl = 'http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile'\nclassifications = client.UnsupervisedClassify({'url': url, 'class': classes})\nfor c in classifications['classes']:\n  print c","language":"python"},{"code":"<?php\n$url = 'http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile';\n$class = array('technology', 'sports');\n$classifications = $textapi->UnsupervisedClassify(array('url' => $url, 'class' => $class));\nforeach($classifications->classes as $c) {\n  printf(\"%s: %f\\n\", $c->label, $c->score);\n}\n?>","language":"php"},{"code":"String[] classes = {\"technology\", \"sports\"};\njava.net.URL url = new java.net.URL(\"http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile\");\nUnsupervisedClassifyParams.Builder builder = UnsupervisedClassifyParams.newBuilder();\nbuilder.setClasses(classes);\nbuilder.setUrl(url);\nUnsupervisedClassifications classifications = client.unsupervisedClassify(builder.build());\nfor (UnsupervisedClass c: classifications.getClasses()) {\n\t\tSystem.out.println(c);\n}","language":"java"},{"code":"classes = ['technology', 'sports']\nurl = 'http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile'\n\nclassifications = client.unsupervised_classify(url: url, class: classes)\n\n\nclassifications[:classes].each do |c|\n  puts c\nend","language":"ruby"},{"code":"classes := []string{\"sports\", \"technology\"}\nurl := \"http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile\"\nclassifyPrams := &textapi.UnsupervisedClassifyParams{URL: url, Classes: classes}\nclassification, err := client.UnsupervisedClassify(classifyPrams)\nif err != nil {\n\t\tpanic(err)\n}\nfor _, c := range classification.Classes {\n\t\tfmt.Printf(\"%v\\n\", c)\n}","language":"go"},{"code":"var classes = new string[] {\"technology\", \"sports\"};\nvar url = \"http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile\";\n\nvar unsupervisedClassify = client.UnsupervisedClassify(url: url, classes: classes);\n\nforeach (var item in unsupervisedClassify.Classes)\n{\n  Console.WriteLine(item.Label + \": \" + item.Score);\n}","language":"csharp"}]},"results":{"codes":[{"name":"","code":"{\n  \"classes\":[\n    {\n      \"label\":\"technology\",\n      \"score\":0.022222222222222223\n    },\n    {\n      \"label\":\"sports\",\n      \"score\":0.0\n    }\n  ],\n  \"text\":\"When Microsoft announced its wrenching $7.6 billion write-down last week, it was easy to presume that the company was giving up on mobile. At the very least, the financial avalanche sent a strong signal that Windows phone in its current guise has failed in a major way.\\n\\nThe 7,800 people sacked in the process, the majority of whom came from the Windows phone division, simply accentuated that point.\\n\\nMicrosoft has badly wanted to be a player in the handset wars, but its market share numbers tell a consistently wretched tale. In the US, it has never managed more than a crawl, and is currently stuck at around the 3 percent mark. The company has seen somewhat higher numbers in some European markets, but there has been evidence that even those relative cratonic bastions have eroded in recent quarters.\\n\\nLuckily or smartly, Microsoft has placed more than one mobile bet and it doesn’t intend to live and die with handsets. It has other bullets left in the chamber including Windows 10 and the cross-platform mobile apps too.\\n\\nWhatever happens, Microsoft can ultimately never walk away from mobile because giving up would essentially be ceding a massive portion of the future of computing, and it simply can’t afford to do that.\\n\\nAfter some time in the soup, Microsoft has finally detailed its Windows mobile strategy well enough in the last week that we can understand it — whether that’s referring to the operating system level, hardware or cross-platform apps. Leaning on Mary Jo Foley’s excellent interview with CEO Satya Nadella, and the write-down, we can come to the following conclusions:\\n\\nThe company made a large wager through Windows 10’s pricing to bolster Windows mobile.\\n\\nThat’s quite plain: Microsoft wanted to go after phone market share in the long term, and selling Windows at its old price points would limit broader Windows 10 adoption, eroding at the company’s larger value proposition of having one platform across all your devices. Put another way, the company is foregoing \"\n}","language":"json","status":200}]},"settings":"","auth":"required","params":[{"_id":"55aba608a36ccd0d00fdebbb","ref":"","in":"query","required":false,"desc":"Text to classify","default":"","type":"string","name":"text"},{"_id":"55a8f048cf45e1390093f249","ref":"","in":"query","required":false,"desc":"Article or webpage to classify","default":"","type":"string","name":"url"},{"_id":"55abc1cc63a6b60d006616f6","ref":"","in":"query","required":false,"desc":"Candidate labels (up to 5)","default":"","type":"array_string","name":"class"},{"_id":"55abc1cc63a6b60d006616f5","ref":"","in":"query","required":false,"desc":"Number of intermediary common topics to consider when calculating semantic similarity","default":"","type":"int","name":"number_of_concepts"},{"_id":"55a8f18bc8bd450d000dd113","ref":"","in":"query","required":false,"desc":"Language (refer to [Language Support](/docs/language-support))","default":"auto","type":"string","name":"language"}],"url":"/classify/unsupervised"},"isReference":false,"order":12,"body":"Similar to [Classification](doc:classification), **Semantic Labeling** or **Unsupervised Classification** can be used to assign semantically-related labels to a piece of text. The difference between the two methods is that in Classification, labels are defined in a predefined taxonomy whereas in Semantic Labeling you can specify the labels on the fly, and receive a sorted list of labels in order of semantic relatedness to the text. This gives you maximum flexibility for categorizing your content.\n\nYou can specify **up to 5 labels** in each request, and class labels can be **unigrams** or **bigrams** (e.g. \"sports\" or \"computer technology\").","excerpt":"/classify/unsupervised","slug":"classify-unsupervised","type":"get","title":"Semantic Labeling"}

getSemantic Labeling

/classify/unsupervised

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

text:
string
Text to classify
url:
string
Article or webpage to classify
class:
array of strings
Candidate labels (up to 5)
number_of_concepts:
integer
Number of intermediary common topics to consider when calculating semantic similarity
language:
stringauto
Language (refer to [Language Support](/docs/language-support))

Examples


Result Format


Documentation

Similar to [Classification](doc:classification), **Semantic Labeling** or **Unsupervised Classification** can be used to assign semantically-related labels to a piece of text. The difference between the two methods is that in Classification, labels are defined in a predefined taxonomy whereas in Semantic Labeling you can specify the labels on the fly, and receive a sorted list of labels in order of semantic relatedness to the text. This gives you maximum flexibility for categorizing your content. You can specify **up to 5 labels** in each request, and class labels can be **unigrams** or **bigrams** (e.g. "sports" or "computer technology").

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}