# DocumentStats

Analyzes the text that you specify and generates basic statistics, such as the number of terms, sentences, paragraphs, and stop words in the specified text, and the number of terms that appear in IDOL Server. You provide query text by setting the Text parameter.

TIP: You can use this action for a quick query syntax check by setting QueryAnalysis. The action returns an error when the query syntax in the Text parameter is incorrect.

NOTE: This is an administrative action that can be sent only by users that belong to an authorization role that allows the `Admin` standard role, or which enables the action explicitly. See Authorization Roles Configuration Parameters.

The following XML is an example of the output of the `DocumentStats` action.

    −<autnresponse>
    <action>DOCUMENTSTATS</action>
    <response>SUCCESS</response>
    −<responsedata>
    <sentences>2</sentences>
    <paragraphs>1</paragraphs>
    −<total>
       <total_terms>23</total_terms>
       <stopwords>10</stopwords>
       <dre_terms>13</dre_terms>
       <average_percent_dococcs>4.216</average_percent_dococcs>
       <average_percent_dredococcs>4.216</   average_percent_dredococcs>
    </total>
    −<distinct>
       <total_terms>21</total_terms>
       <stopwords>10</stopwords>
       <dre_terms>11</dre_terms>
       <average_percent_dococcs>4.522</average_percent_dococcs>
       <average_percent_dredococcs>4.522</average_percent_dredococcs>
    </distinct>
    −<characters>
       <total>134</total>
       <percent_alphabetic>80.60</percent_alphabetic>
       <percent_uppercase>1.49</percent_uppercase>
       <percent_numeric>0.00</percent_numeric>
       <percent_whitespace>16.42</percent_whitespace>
       <percent_punctuation>2.99</percent_punctuation>
       <percent_control>0.00</percent_control>
       <utf8_1-byte>134</utf8_1-byte>
       <utf8_2-byte>0</utf8_2-byte>
       <utf8_3-byte>0</utf8_3-byte>
    </characters>
    </responsedata>
    </autnresponse>

NOTE: To use `DocumentStats` for queries that include Wildcard terms, you must set the TermPositions parameter to `True`.

## Example

    http://12.3.4.56:9000/action=DocumentStats&Text="businesses"&LanguageType=englishASCII

This action requests document statistics for the term `businesses` from IDOL Server.

## Required Parameters

The following action parameters are required.

Parameter | Description
--- | ---
Text | The text to return statistics for.

## Optional Parameters

This action accepts the following optional parameters.

Parameter | Description
--- | ---
AnyLanguage | Allows IDOL Server to return documents in any language.
CostEstimate | Whether to return a cost estimate for the query.
LanguageType | The language type of the text.
MatchID | A list of document references from which to return the term position for the specified text.
MatchReference | A list of document references from which to return the term position for the specified text.
QueryAnalysis | Returns information about the elements of a query.
QueryStats | Whether to return information about the optimal content to use for an AgentBoolean rule.
Synchronous | Whether to run the action synchronously or asynchronously.
Text | The text to return statistics for.
TermPositions | Returns a list of the positions of the occurrences of any terms that satisfy the query text.

This action accepts the following standard ACI action parameters.

Parameter | Description
--- | ---
ActionID | A string to use to identify an ACI action.
EncryptResponse | Encrypt the output.
FileName | The file to write output to.
ForceTemplateRefresh | Forces the server to load the template from disk.
Output | Writes output to a file.
ResponseFormat | The format of the action output.
Template | The template to use for the action output.
TemplateParamCSVs | A list of variables to use for the specified template.

_FT_HTML5_bannerTitle.htm