Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WP CLI command docs #259

Merged
merged 4 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 92 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* [Register ClassifAI account](#register-classifai-account)
* [Set Up Language Processing](#set-up-language-processing-via-ibm-watson)
* [Set Up Image Processing](#set-up-image-processing-via-microsoft-azure)
* [WP CLI Usage Instructions](#wp-cli-usage-instructions)
* [WP CLI Commands](#wp-cli-commands)
* [FAQs](#frequently-asked-questions)
* [Support](#support-level)
* [Changelog](#changelog)
Expand Down Expand Up @@ -116,15 +116,25 @@ Note that [Computer Vision](https://docs.microsoft.com/en-us/azure/cognitive-ser

#### 3. Save Image to classify image

## WP CLI Usage Instructions
## WP CLI Commands

#### 1. Batch Classify Posts
### Language Processing Commands

`$ wp classifai post {post_ids} [--post_type=post_type] [--limit=limit] [--link=link]`
#### Batch Classify Posts

`$ wp classifai post {post_ids} [--post_type=<post_type>] [--limit=<limit>] [--link=<link>]`

Batch post classification using IBM Watson NLU API.

##### Options

`--post_type=post_type`
**`{post_ids}`**

A comma delimited list of post IDs to classify. Used if `post_type` is false or absent.

default: `true`

**`--post_type=<post_type>`**

Batch classify posts belonging to this post type. If `false` or absent relies on `post_ids`.

Expand All @@ -133,15 +143,7 @@ options:
- any post type name
- `false`, if args contains `post_ids`


`{ post_ids }`

A comma delimited list of post ids to classify. Used if `post_type` is false or absent.

default: `true`


`--limit=limit`
**`--limit=<limit>`**

Limit classification to N posts.

Expand All @@ -150,79 +152,129 @@ options:
- `false`, no limit
- `N`, max number of posts to classify

`--link=link`
**`--link=<link>`**

Whether to link classification results to Taxonomy terms
Whether to link classification results to Taxonomy terms.

default: `true`

#### 2. Classify Text
#### Classify Text

`$ wp classifai text {text} [--category=bool] [--keyword=bool] [--concept=bool] [--entity=bool] [--input=input] [--only-normalize=bool]`
`$ wp classifai text {text} [--category=<bool>] [--keyword=<bool>] [--concept=<bool>] [--entity=<bool>] [--input=<input>] [--only-normalize=<bool>]`

Directly classify text using Watson NLU.
Directly classify text using IBM Watson NLU API.

##### Options

`--category=bool`
**`--category=<bool>`**

Enables NLU category feature
Enables NLU category feature.

default: `true`

`--keyword=bool`
**`--keyword=<bool>`**

Enables NLU keyword feature
Enables NLU keyword feature.

default: `true`

`--concept=bool`
**`--concept=<bool>`**

Enables NLU concept feature
Enables NLU concept feature.

default: `true`

`--entity=bool`
**`--entity=<bool>`**

Enables NLU entity feature
Enables NLU entity feature.

default: `true`

`--input=input`
**`--input=<input>`**

Path to input file or URL
Path to input file or URL.

default: `false`
options:
- path to local file
- path to remote URL
- `false`, uses args[0] instead

`--only-normalize=<bool>`
**`--only-normalize=<bool>`**

Prints the normalized text that will be sent to the NLU API
Prints the normalized text that will be sent to the NLU API.

default: `false`

#### 3. Classify Image
### Image Processing Commands

#### Classify Attachments

`$ wp classifai image {image_ids} [--limit=int] [--force]`
`$ wp classifai image {attachment_ids} [--limit=<int>] [--skip=<skip>] [--force]`

Directly classify images using Azure Computer Vision.
Directly add description "alt text" and tags to attachment(s) using Azure AI Computer Vision API.

##### Options

`--limit=int`
**`{attachment_ids}`**

Limit number of images to classify.
Comma delimeted list of Attachment IDs to classify.

default: `false`
**`--limit=<int>`**

`--force`
Limit number of attachments to classify.

Force classifying images regardless of their `alt`.
default: `100`.

default: `false`
**`--skip=<skip>`**

Skip first N attachments.

default: `false`.

**`--force`**

Force classifying attachments regardless of their `alt`.

default: `false`.

#### Image Cropping

`$ wp classifai crop {attachment_ids} [--limit=<limit>] [--skip=<skip>]`

Batch crop image(s) using Azure AI Computer Vision API.

##### Options

**`{attachment_ids}`**

Comma delimeted list of Attachment IDs to crop.

**`--limit=<limit>`**

Limit number of images to crop.

default: `100`.

**`--skip=<skip>`**

Skip first N images.

default: `false`.

### ClassifAI Settings Commands

#### Basic Authentication

`$ wp classifai auth`

Prints the Basic Auth header based on credentials configured in the plugin.

#### Reset ClassifAI to Defaults

`$ wp classifai reset`

Restores the plugin configuration to factory defaults. Any API credentials will need to be re-entered after this is ran.

## Frequently Asked Questions

Expand Down
5 changes: 3 additions & 2 deletions includes/Classifai/Command/ClassifaiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
/**
* ClassifaiCommand is the command line interface of the ClassifAI plugin.
* It provides subcommands to test classification results and batch
* classify posts using the IBM Watson NLU API.
* classify posts using the IBM Watson NLU API and images using the
* Azure AI Computer Vision API.
*/
class ClassifaiCommand extends \WP_CLI_Command {

Expand Down Expand Up @@ -291,7 +292,7 @@ public function image( $args = [], $opts = [] ) {
* : Comma delimited Attachment IDs to crop.
*
* [--limit=<limit>]
* : Limit classification to N attachments. Default 100.
* : Limit cropping to N attachments. Default 100.
*
* [--skip=<skip>]
* : Skip first N attachments. Default false.
Expand Down