This package contains a set of intelligent APIs understanding images: It can detect and analyze people's faces, their age, gender, and similarity. It can identify people based on a set of images. It can understand what is displayed in a picture and crop it according to where the important features are. It can tell you whether an image contains adult content, what the main colors are, and which of your images belong in a group. If your image features text, it will tell you the language and return the text as a string. It's basically magic. For more details on the Project Oxford API, please visit projectoxford.ai.
This Node module implements Project Oxford's API for Faces, Vision, Text, Video, and WebLM.
To install this package, run npm install --save project-oxford
and obtain an API key. To obtain such a key, you will also need an (free) Microsoft Azure Account. Once you got your key, you can instantiate an Oxford client in your code:
var oxford = require('project-oxford'),
client = new oxford.Client('7fb073s72bh72663y5ddh129m12e598d');
Now that you got your client running, you're ready to do some pretty smart stuff. Have a picture of a person and want a computed guess of their age and gender?
client.face.detect({
path: 'myFolder/myFace.jpg',
analyzesAge: true,
analyzesGender: true
}).then(function (response) {
console.log('The age is: ' + response[0].attributes.age);
console.log('The gender is: ' + response[0].attributes.gender);
});
Have a picture of a person and want a computed guess about their emotions?
client.emotion.analyzeEmotion({
path: './myFace.jpg',
}).then(function (response) {
console.log(response);
});
Or, you can add the rectangle of the face yourself, in the form "left,top,width,height". Delimited multiple face rectangles with a “;”.
client.emotion.analyzeEmotion({
path: './myFace.jpg',
faceRectangles: '10, 10, 100, 100'
}).then(function (response) {
console.log(response);
});
Creating a smart-cropped thumbnail:
client.vision.thumbnail({
path: './photo.jpg',
height: 150,
width: 150,
smartCropping: true,
pipe: fs.createWriteStream('./photo2.jpg')
});
Running OCR on an image, returning the text on the image:
visionClient.vision.ocr({
path: './test/images/ocr.jpg',
language: 'en'
}).then(function (response) {
console.log(response.body);
});
For the full documentation, please see the API reference below.
Kind: global class
- Client
- new Client(key)
- .emotion :
object
- ~analyzeEmotion(options) ⇒
Promise
- ~analyzeEmotion(options) ⇒
- .face :
object
- static
- .faceList :
object
- .list() ⇒
Promise
- .create(faceListId, options) ⇒
Promise
- .update(faceListId, options) ⇒
Promise
- .delete(faceListId) ⇒
Promise
- .get(faceListId) ⇒
Promise
- .addFace(faceListId, options) ⇒
Promise
- .deleteFace(faceListId, persistedFaceId) ⇒
Promise
- .list() ⇒
- .personGroup :
object
- .create(personGroupId, name, userData) ⇒
Promise
- .delete(personGroupId) ⇒
Promise
- .get(personGroupId) ⇒
Promise
- .trainingStatus(personGroupId) ⇒
Promise
- .trainingStart(personGroupId) ⇒
Promise
- .update(personGroupId, name, userData) ⇒
Promise
- .list() ⇒
Promise
- .create(personGroupId, name, userData) ⇒
- .person :
object
- .addFace(personGroupId, personId, options) ⇒
Promise
- .deleteFace(personGroupId, personId, persistedFaceId) ⇒
Promise
- .updateFace(personGroupId, personId, persistedFaceId, userData) ⇒
Promise
- .getFace(personGroupId, personId, persistedFaceId) ⇒
Promise
- .create(personGroupId, name, userData) ⇒
Promise
- .delete(personGroupId, personId) ⇒
Promise
- .get(personGroupId, personId) ⇒
Promise
- .update(personGroupId, name, userData) ⇒
Promise
- .list(personGroupId) ⇒
Promise
- .addFace(personGroupId, personId, options) ⇒
- .faceList :
- inner
- ~detect(options) ⇒
Promise
- ~similar(sourceFace, options) ⇒
Promise
- ~grouping(faces) ⇒
Promise
- ~identify(faces, personGroupId, maxNumOfCandidatesReturned) ⇒
Promise
- ~verify(faces) ⇒
Promise
- ~detect(options) ⇒
- static
- .text :
object
- .video :
object
- static
- .result
- .get(operation) ⇒
Promise
- .getVideo(url, pipe) ⇒
Promise
- .get(operation) ⇒
- .result
- inner
- ~trackFace(options) ⇒
Promise
- ~detectMotion(options) ⇒
Promise
- ~stabilize(options) ⇒
Promise
- ~trackFace(options) ⇒
- static
- .vision :
object
- ~analyzeImage(options) ⇒
Promise
- ~thumbnail(options) ⇒
Promise
- ~ocr(options) ⇒
Promise
- ~analyzeImage(options) ⇒
- .weblm :
object
- ~listModels() ⇒
Promise
- ~breakIntoWords(model, text, options) ⇒
Promise
- ~generateWords(model, words, options) ⇒
Promise
- ~getJointProbabilities(model, phrases, order) ⇒
Promise
- ~getConditionalProbabilities(model, queries, order) ⇒
Promise
- ~listModels() ⇒
Creates a new Project Oxford Client using a given API key.
Param | Type | Description |
---|---|---|
key | string |
Project Oxford API Key |
Kind: static namespace of Client
Analyze the emotions of one or more faces in an image.
Kind: inner method of emotion
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
options | Object |
Options object |
options.url | string |
URL to the image file |
options.path | string |
URL to a local image file |
options.faceRectangles | Array.<Object> |
Array of face rectangles. Face rectangles are returned in the face.detect and vision.analyzeImage methods. |
Kind: static namespace of Client
- .face :
object
- static
- .faceList :
object
- .list() ⇒
Promise
- .create(faceListId, options) ⇒
Promise
- .update(faceListId, options) ⇒
Promise
- .delete(faceListId) ⇒
Promise
- .get(faceListId) ⇒
Promise
- .addFace(faceListId, options) ⇒
Promise
- .deleteFace(faceListId, persistedFaceId) ⇒
Promise
- .list() ⇒
- .personGroup :
object
- .create(personGroupId, name, userData) ⇒
Promise
- .delete(personGroupId) ⇒
Promise
- .get(personGroupId) ⇒
Promise
- .trainingStatus(personGroupId) ⇒
Promise
- .trainingStart(personGroupId) ⇒
Promise
- .update(personGroupId, name, userData) ⇒
Promise
- .list() ⇒
Promise
- .create(personGroupId, name, userData) ⇒
- .person :
object
- .addFace(personGroupId, personId, options) ⇒
Promise
- .deleteFace(personGroupId, personId, persistedFaceId) ⇒
Promise
- .updateFace(personGroupId, personId, persistedFaceId, userData) ⇒
Promise
- .getFace(personGroupId, personId, persistedFaceId) ⇒
Promise
- .create(personGroupId, name, userData) ⇒
Promise
- .delete(personGroupId, personId) ⇒
Promise
- .get(personGroupId, personId) ⇒
Promise
- .update(personGroupId, name, userData) ⇒
Promise
- .list(personGroupId) ⇒
Promise
- .addFace(personGroupId, personId, options) ⇒
- .faceList :
- inner
- ~detect(options) ⇒
Promise
- ~similar(sourceFace, options) ⇒
Promise
- ~grouping(faces) ⇒
Promise
- ~identify(faces, personGroupId, maxNumOfCandidatesReturned) ⇒
Promise
- ~verify(faces) ⇒
Promise
- ~detect(options) ⇒
- static
Kind: static namespace of face
- .faceList :
object
- .list() ⇒
Promise
- .create(faceListId, options) ⇒
Promise
- .update(faceListId, options) ⇒
Promise
- .delete(faceListId) ⇒
Promise
- .get(faceListId) ⇒
Promise
- .addFace(faceListId, options) ⇒
Promise
- .deleteFace(faceListId, persistedFaceId) ⇒
Promise
- .list() ⇒
Lists the faceListIds, and associated names and/or userData.
Kind: static method of faceList
Returns: Promise
- - Promise resolving with the resulting JSON
Creates a new face list with a user-specified ID. A face list is a list of faces associated to be associated with a given person.
Kind: static method of faceList
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
faceListId | string |
Numbers, en-us letters in lower case, '-', '_'. Max length: 64 |
options | object |
Optional parameters |
options.name | string |
Name of the face List |
options.userData | string |
User-provided data associated with the face list. |
Creates a new person group with a user-specified ID. A person group is one of the most important parameters for the Identification API. The Identification searches person faces in a specified person group.
Kind: static method of faceList
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
faceListId | string |
Numbers, en-us letters in lower case, '-', '_'. Max length: 64 |
options | object |
Optional parameters |
options.name | string |
Name of the face List |
options.userData | string |
User-provided data associated with the face list. |
Deletes an existing person group.
Kind: static method of faceList
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
faceListId | string |
ID of face list to delete |
Gets an existing face list.
Kind: static method of faceList
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
faceListId | string |
ID of face list to retrieve |
Gets an existing face list.
Kind: static method of faceList
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
faceListId | string |
ID of face list to retrieve |
options | object |
Options object |
options.url | string |
URL to image to be used |
options.path | string |
Path to image to be used |
options.stream | stream |
Stream for image to be used |
options.name | string |
Optional name for the face |
options.userData | string |
Optional user-data for the face |
Delete a face from the face list. The face ID will be an ID returned in the addFace method, not from the detect method.
Kind: static method of faceList
Returns: Promise
- - Promise; successful response is empty
Param | Type | Description |
---|---|---|
faceListId | string |
ID of face list to retrieve |
persistedFaceId | string |
ID of face in the face list |
Kind: static namespace of face
- .personGroup :
object
- .create(personGroupId, name, userData) ⇒
Promise
- .delete(personGroupId) ⇒
Promise
- .get(personGroupId) ⇒
Promise
- .trainingStatus(personGroupId) ⇒
Promise
- .trainingStart(personGroupId) ⇒
Promise
- .update(personGroupId, name, userData) ⇒
Promise
- .list() ⇒
Promise
- .create(personGroupId, name, userData) ⇒
Creates a new person group with a user-specified ID. A person group is one of the most important parameters for the Identification API. The Identification searches person faces in a specified person group.
Kind: static method of personGroup
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
Numbers, en-us letters in lower case, '-', '_'. Max length: 64 |
name | string |
Person group display name. The maximum length is 128. |
userData | string |
User-provided data attached to the group. The size limit is 16KB. |
Deletes an existing person group.
Kind: static method of personGroup
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
Name of person group to delete |
Gets an existing person group.
Kind: static method of personGroup
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
Name of person group to get |
Retrieves the training status of a person group. Training is triggered by the Train PersonGroup API. The training will process for a while on the server side. This API can query whether the training is completed or ongoing.
Kind: static method of personGroup
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
Name of person group to get |
Starts a person group training. Training is a necessary preparation process of a person group before identification. Each person group needs to be trained in order to call Identification. The training will process for a while on the server side even after this API has responded.
Kind: static method of personGroup
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
Name of person group to get |
Updates an existing person group's display name and userData.
Kind: static method of personGroup
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
Numbers, en-us letters in lower case, '-', '_'. Max length: 64 |
name | string |
Person group display name. The maximum length is 128. |
userData | string |
User-provided data attached to the group. The size limit is 16KB. |
Lists all person groups in the current subscription.
Kind: static method of personGroup
Returns: Promise
- - Promise resolving with the resulting JSON
Kind: static namespace of face
- .person :
object
- .addFace(personGroupId, personId, options) ⇒
Promise
- .deleteFace(personGroupId, personId, persistedFaceId) ⇒
Promise
- .updateFace(personGroupId, personId, persistedFaceId, userData) ⇒
Promise
- .getFace(personGroupId, personId, persistedFaceId) ⇒
Promise
- .create(personGroupId, name, userData) ⇒
Promise
- .delete(personGroupId, personId) ⇒
Promise
- .get(personGroupId, personId) ⇒
Promise
- .update(personGroupId, name, userData) ⇒
Promise
- .list(personGroupId) ⇒
Promise
- .addFace(personGroupId, personId, options) ⇒
Adds a face to a person for identification. The maximum face count for each person is 248.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
personId | string |
The target person that the face is added to. |
options | object |
The source specification. |
options.url | string |
URL to image to be used. |
options.path | string |
Path to image to be used. |
options.stream | stream |
Stream for image to be used. |
options.userData | string |
Optional. Attach user data to person's face. The maximum length is 1024. |
options.targetFace | object |
Optional. The rectangle of the face in the image. |
Deletes a face from a person.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
personId | string |
The target person that the face is removed from. |
persistedFaceId | string |
The ID of the face to be deleted. |
Updates a face for a person.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
personId | string |
The target person that the face is updated on. |
persistedFaceId | string |
The ID of the face to be updated. |
userData | string |
Optional. Attach user data to person's face. The maximum length is 1024. |
Get a face for a person.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
personId | string |
The target person that the face is to get from. |
persistedFaceId | string |
The ID of the face to get. |
Creates a new person in a specified person group for identification. The number of persons has a subscription limit. Free subscription amount is 1000 persons.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
name | string |
Target person's display name. The maximum length is 128. |
userData | string |
Optional fields for user-provided data attached to a person. Size limit is 16KB. |
Deletes an existing person from a person group.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
personId | string |
The target person to delete. |
Gets an existing person from a person group.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
personId | string |
The target person to get. |
Updates a person's information.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
name | string |
Target person's display name. The maximum length is 128. |
userData | string |
Optional fields for user-provided data attached to a person. Size limit is 16KB. |
Lists all persons in a person group, with the person information.
Kind: static method of person
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
personGroupId | string |
The target person's person group. |
Call the Face Detected API Detects human faces in an image and returns face locations, face landmarks, and optional attributes including head-pose, gender, and age. Detection is an essential API that provides faceId to other APIs like Identification, Verification, and Find Similar.
Kind: inner method of face
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
options | object |
Options object |
options.url | string |
URL to image to be used |
options.path | string |
Path to image to be used |
options.stream | stream |
Stream for image to be used |
options.returnFaceId | boolean |
Include face ID in response? |
options.analyzesFaceLandmarks | boolean |
Analyze face landmarks? |
options.analyzesAge | boolean |
Analyze age? |
options.analyzesGender | boolean |
Analyze gender? |
options.analyzesHeadPose | boolean |
Analyze headpose? |
options.analyzesSmile | boolean |
Analyze smile? |
options.analyzesFacialHair | boolean |
Analyze facial hair? |
Detect similar faces using faceIds (as returned from the detect API), or faceListId (as returned from the facelist API).
Kind: inner method of face
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
sourceFace | string |
String of faceId for the source face |
options | object |
Options object |
options.candidateFaces | Array.<string> |
Array of faceIds to use as candidates |
options.candidateFaceListId | string |
Id of face list, created via FaceList.create |
options.maxCandidates | Number |
Optional max number for top candidates (default is 20, max is 20) |
Divides candidate faces into groups based on face similarity using faceIds. The output is one or more disjointed face groups and a MessyGroup. A face group contains the faces that have similar looking, often of the same person. There will be one or more face groups ranked by group size, i.e. number of face. Faces belonging to the same person might be split into several groups in the result. The MessyGroup is a special face group that each face is not similar to any other faces in original candidate faces. The messyGroup will not appear in the result if all faces found their similar counterparts. The candidate face list has a limit of 100 faces.
Kind: inner method of face
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
faces | Array.<string> |
Array of faceIds to use |
Identifies persons from a person group by one or more input faces. To recognize which person a face belongs to, Face Identification needs a person group that contains number of persons. Each person contains one or more faces. After a person group prepared, it should be trained to make it ready for identification. Then the identification API compares the input face to those persons' faces in person group and returns the best-matched candidate persons, ranked by confidence.
Kind: inner method of face
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
faces | Array.<string> |
Array of faceIds to use |
personGroupId | string |
Id of person group from which faces will be identified |
maxNumOfCandidatesReturned | Number |
Optional max number of candidates per face (default=1, max=5) |
Analyzes two faces and determine whether they are from the same person. Verification works well for frontal and near-frontal faces. For the scenarios that are sensitive to accuracy please use with own judgment.
Kind: inner method of face
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
faces | Array.<string> |
Array containing two faceIds to use |
Kind: static namespace of Client
- .text :
object
Proofs a word or phrase. Offers Microsoft Office Word-like spelling corrections. Longer phrases can be checked, and the result will include casing corrections while avoiding aggressive corrections.
Kind: inner method of text
Returns: Promise
- - A promise in which the resulting JSON is returned.
Param | Type | Description |
---|---|---|
text | string |
Word or phrase to spell check. |
preContextText | string |
Optional context of one or more words preceding the target word/phrase. |
postContextText | string |
Optional context of one or more words following the target word/phrase. |
Spell checks a word or phrase. Spell checks offers search-engine-like corrections. Short phrases (up to 9 tokens) will be checked, and the result will be optimized for search queries, both in terms of performance and relevance.
Kind: inner method of text
Returns: Promise
- - A promise in which the resulting JSON is returned.
Param | Type | Description |
---|---|---|
text | string |
Word or phrase to spell check. |
preContextText | string |
Optional context of one or more words preceding the target word/phrase. |
postContextText | string |
Optional context of one or more words following the target word/phrase. |
Kind: static namespace of Client
- .video :
object
- static
- .result
- .get(operation) ⇒
Promise
- .getVideo(url, pipe) ⇒
Promise
- .get(operation) ⇒
- .result
- inner
- ~trackFace(options) ⇒
Promise
- ~detectMotion(options) ⇒
Promise
- ~stabilize(options) ⇒
Promise
- ~trackFace(options) ⇒
- static
Kind: static property of video
- .result
- .get(operation) ⇒
Promise
- .getVideo(url, pipe) ⇒
Promise
- .get(operation) ⇒
Checks the result of a given operation. When an operation is deemed completed, the status of the returned object should be 'Succeeded' (or, possibly, 'Failed'.) For operations which return a JSON payload, the stringified-JSON is returned in the processingResult field. For operations which return a video, the location of the video is provided in the resourceLocation field. You can use the getVideo method to help you retrieve that, as this would automatically attach the API key to request.
Kind: static method of result
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
operation | Object |
Object holding the result URL |
Downloads the resulting video, for processors that returning videos instead of metadata. Currently this applies to the stabilize operation.
Kind: static method of result
Returns: Promise
- - Promise resolving with the resulting video
Param | Type | Description |
---|---|---|
url | string |
URL of the resource |
pipe | Object |
Destination for video, typically a fs object |
Start a face-tracking processor Faces in a video will be tracked.
Kind: inner method of video
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
options | object |
Options object |
options.url | string |
URL to video to be processed |
options.path | string |
Path to video to be processed |
options.stream | stream |
Stream for video to be processed |
Start a motion-tracking processor Motion in a video will be tracked.
Kind: inner method of video
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
options | object |
Options object |
options.url | string |
URL to video to be processed |
options.path | string |
Path to video to be processed |
options.stream | stream |
Stream for video to be processed |
Start a stablization processor A stabilized version of you video will be generated.
Kind: inner method of video
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
options | object |
Options object |
options.url | string |
URL to video to be processed |
options.path | string |
Path to video to be processed |
options.stream | stream |
Stream for video to be processed |
Kind: static namespace of Client
- .vision :
object
- ~analyzeImage(options) ⇒
Promise
- ~thumbnail(options) ⇒
Promise
- ~ocr(options) ⇒
Promise
- ~analyzeImage(options) ⇒
This operation does a deep analysis on the given image and then extracts a set of rich visual features based on the image content.
Kind: inner method of vision
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
options | Object |
Options object describing features to extract |
options.url | string |
Url to image to be analyzed |
options.path | string |
Path to image to be analyzed |
options.ImageType | boolean |
Detects if image is clipart or a line drawing. |
options.Color | boolean |
Determines the accent color, dominant color, if image is black&white. |
options.Faces | boolean |
Detects if faces are present. If present, generate coordinates, gender and age. |
options.Adult | boolean |
Detects if image is pornographic in nature (nudity or sex act). Sexually suggestive content is also detected. |
options.Categories | boolean |
Image categorization; taxonomy defined in documentation. |
options.Tags | boolean |
Tags the image with a detailed list of words related to the image content. |
options.Description | boolean |
Describes the image content with a complete English sentence. |
Generate a thumbnail image to the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart crop coordinates based on the ROI. Smart cropping is designed to help when you specify an aspect ratio that differs from the input image.
Kind: inner method of vision
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
options | Object |
Options object describing features to extract |
options.url | string |
Url to image to be thumbnailed |
options.path | string |
Path to image to be thumbnailed |
options.width | number |
Width of the thumb in pixels |
options.height | number |
Height of the thumb in pixels |
options.smartCropping | boolean |
Should SmartCropping be enabled? |
options.pipe | Object |
We'll pipe the returned image to this object |
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream.
Kind: inner method of vision
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
options | Object |
Options object describing features to extract |
options.url | string |
Url to image to be analyzed |
options.path | string |
Path to image to be analyzed |
options.language | string |
BCP-47 language code of the text to be detected in the image. Default value is "unk", then the service will auto detect the language of the text in the image. |
options.detectOrientation | string |
Detect orientation of text in the image |
Kind: static namespace of Client
- .weblm :
object
- ~listModels() ⇒
Promise
- ~breakIntoWords(model, text, options) ⇒
Promise
- ~generateWords(model, words, options) ⇒
Promise
- ~getJointProbabilities(model, phrases, order) ⇒
Promise
- ~getConditionalProbabilities(model, queries, order) ⇒
Promise
- ~listModels() ⇒
List available language models for the service currently.
Kind: inner method of weblm
Returns: Promise
- - Promise resolving with the resulting JSON
Breaks text in to consituent words
Kind: inner method of weblm
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
model | string |
Name of model. Currently one of title/anchor/query/body |
text | string |
Text to break. E.g. onetwothree |
options | Object |
Options object |
options.order | Number |
Optional N-gram order. Default is 5 |
options.maxCandidates | Number |
Optional maximum candidate count. Default is 5 |
Generates a list of candidate of words that would follow the a given sequence of one or more words
Kind: inner method of weblm
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
model | string |
Name of model. Currently one of title/anchor/query/body |
words | string |
Text to break. E.g. 'hello world wide' |
options | Object |
Options object |
options.order | Number |
Optional N-gram order. Default is 5 |
options.maxCandidates | Number |
Optional maximum candidate count. Default is 5 |
Generates a list of candidate of words that would follow the a given sequence of one or more words
Kind: inner method of weblm
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
model | string |
Name of model. Currently one of title/anchor/query/body |
phrases | Array.<string> |
One or more phrases for which to look up the probalities of the word sequences |
order | Number |
Optional N-gram order. Default is 5 |
Generates a list of candidate of words that would follow the a given sequence of one or more words
Kind: inner method of weblm
Returns: Promise
- - Promise resolving with the resulting JSON
Param | Type | Description |
---|---|---|
model | string |
Name of model. Currently one of title/anchor/query/body |
queries | Array |
One of more objects consisting of 'words'/'word' pairs, where the conditional probability of 'word' in the context of 'words' is computed. |
order | Number |
Optional N-gram order. Default is 5 |
Licensed as MIT - please see LICENSE for details.