PHP Class DaveChild\TextStatistics\Syllables

Datei anzeigen Open project: nystudio107/seomatic Class Usage Examples

Public Properties

Property Type Description
$arrAddSyllables These syllables would be counted as one but should be two
$arrAffix Single syllable prefixes and suffixes
$arrDoubleAffix Double syllable prefixes and suffixes
$arrProblemWords - Portmanteaus
$arrSubSyllables These syllables would be counted as two but should be one
$arrTripleAffix Triple syllable prefixes and suffixes

Public Methods

Method Description
averageSyllablesPerWord ( string $strText, string $strEncoding = '' ) : integer | float Returns average syllables per word for text.
percentageWordsWithThreeSyllables ( string $strText, boolean $blnCountProperNouns = true, $strEncoding = '' ) : integer | float Returns the percentage of words with more than three syllables
syllableCount ( string $strWord, string $strEncoding = '' ) : integer Returns the number of syllables in the word.
totalSyllables ( string $strText, string $strEncoding = '' ) : integer Returns total syllable count for text.
wordsWithThreeSyllables ( string $strText, boolean $blnCountProperNouns = true, string $strEncoding = '' ) : integer Returns the number of words with more than three syllables

Method Details

averageSyllablesPerWord() public static method

Returns average syllables per word for text.
public static averageSyllablesPerWord ( string $strText, string $strEncoding = '' ) : integer | float
$strText string Text to be measured
$strEncoding string Encoding of text
return integer | float

percentageWordsWithThreeSyllables() public static method

Returns the percentage of words with more than three syllables
public static percentageWordsWithThreeSyllables ( string $strText, boolean $blnCountProperNouns = true, $strEncoding = '' ) : integer | float
$strText string Text to be measured
$blnCountProperNouns boolean Boolean - should proper nouns be included in words count
return integer | float

syllableCount() public static method

Based in part on Greg Fast's Perl module Lingua::EN::Syllables
public static syllableCount ( string $strWord, string $strEncoding = '' ) : integer
$strWord string Word to be measured
$strEncoding string Encoding of text
return integer

totalSyllables() public static method

Returns total syllable count for text.
public static totalSyllables ( string $strText, string $strEncoding = '' ) : integer
$strText string Text to be measured
$strEncoding string Encoding of text
return integer

wordsWithThreeSyllables() public static method

Returns the number of words with more than three syllables
public static wordsWithThreeSyllables ( string $strText, boolean $blnCountProperNouns = true, string $strEncoding = '' ) : integer
$strText string Text to be measured
$blnCountProperNouns boolean Boolean - should proper nouns be included in words count
$strEncoding string Encoding of text
return integer

Property Details

$arrAddSyllables public_oe static_oe property

These syllables would be counted as one but should be two
public static $arrAddSyllables

$arrAffix public_oe static_oe property

Single syllable prefixes and suffixes
public static $arrAffix

$arrDoubleAffix public_oe static_oe property

Double syllable prefixes and suffixes
public static $arrDoubleAffix

$arrProblemWords public_oe static_oe property

- Portmanteaus
public static $arrProblemWords

$arrSubSyllables public_oe static_oe property

These syllables would be counted as two but should be one
public static $arrSubSyllables

$arrTripleAffix public_oe static_oe property

Triple syllable prefixes and suffixes
public static $arrTripleAffix