# Module: wordStringParsing

Contains all system defined business rules for parsing words and lists.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 1

### Requires

- module:ruleParsing
- module:configurator
- module:loggers
- @haystacks/constants
- math
- path

### Methods

#### (inner) aggregateNumericalDifferenceBetweenTwoStrings(inputData, inputMetaData) → {integer}

Determines the delta difference between the two input strings and returns it as a number.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | String 1 to compare.
`inputMetaData` | string | String 2 to compare.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 401

##### Returns:

The delta difference between the two strings, expressed as a number.

Type
  integer

#### (inner) compareSimplifiedAndConsolidatedStrings(inputData, inputMetaData) → {boolean}

Compares two strings by their simplified versions (see simplifyAndConsolidateString()).

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The first string to be compared.
`inputMetaData` | string | The second string to be compared.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 144

##### Returns:

A True or False value to indicate if the strings are virtually identical or not.

Type
  boolean

#### (inner) countCamelCaseWords(inputData, inputMetaData) → {integer}

Takes a string in camelCase and returns the number of words that it contains based on camel case rules.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | String to count words from.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 167

##### Returns:

The number of camel case words found in the string.

Type
  integer

#### (inner) countDelimiterInString(inputData, inputMetaData) → {integer}

Takes a string and returns the number of specified delimiters it contains.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | String to count delimiters from.
`inputMetaData` | string | The delimiter that should be used when counting from the input string.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 310

##### Returns:

The number of delimiters found in the string.

Type
  integer

#### (inner) determineWordDelimiter(inputData, inputMetaData) → {string}

Determines what delimiter should e used to break a string up into words if possible.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be examined to determine what delimiter should be used to break it up into words.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 235

##### Returns:

The delimiter that should be used, or if camelCase then the function will return the string "CamelCase".

Type
  string

#### (inner) doesStringContainAcronym(inputData, inputMetaData) → {boolean}

Scans a string and determines if there are 2 or more immediately adjacent upper-case characters in the string. Example: nodeJS where JS is an acronym for JavaScript.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be scanned to determine if it contains an acronym or not.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 198

##### Returns:

True or False to indicate if the input string contains an acronym.

Type
  boolean

#### (inner) getWordCountInString(inputData, inputMetaData) → {integer}

Gets the number of words in a string, it expects words to be delimited by either camel-case, spaces, period, dash, underscore, plus or percent symbols.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that words should be counted from.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 334

##### Returns:

The number of words that were found in the string.

Type
  integer

#### (inner) isStringCamelCase(inputData, inputMetaData) → {boolean}

Determines if an input string is a camel case string or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be checked for the camel case qualifications.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 30

##### Returns:

True or False to indicate if the string is camel case or not.

Type
  boolean

#### (inner) isStringList(inputData, inputMetaData) → {boolean}

Determines if the input string is a list or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be checked if it is a list or not.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 367

##### Returns:

True or False to indicate if the input string is a list or not a list. Using the list of system defined primary, secondary or tertiary command delimiters.

Type
  boolean

#### (inner) mapWordToCamelCaseWord(inputData, inputMetaData) → {string}

Takes a string key and an indexed string value and maps the word to an upper case first letter word.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string key/value that should be converted to a camel case word.
`inputMetaData` | string | The string index for the map to the value that should be used.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 92

##### Returns:

A string where the word has been converted into a camel case word.

Type
  string

#### (inner) simplifyAndConsolidateString(inputData, inputMetaData) → {string}

Takes a string, and returns a version of it converted to lower case, with all digits and symbols and whitespace removed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be simplified and consolidated.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/wordStringParsing.js, line 115

##### Returns:

A string that has been simplified and consolidated by converting to lower case, removing all digits, symbols and white space.

Type
  string