Text_Statistics
[ class tree: Text_Statistics ] [ index: Text_Statistics ] [ all elements ]

Class: Text_Word

Source Location: /Text_Statistics-1.0.1/Text/Word.php

Class Overview


Text_Word calculates the number of syllables in a word, based off of the number of contiguous vowel groupings in the word and applying matches to detect special cases.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 33]
Text_Word calculates the number of syllables in a word, based off of the number of contiguous vowel groupings in the word and applying matches to detect special cases.

require_once 'Text/Word.php' $word = new Text_Word('word'); $word->numSyllables(); // returns 1



[ Top ]


Class Variables

$doubleSyllables = array('/\wlien/', // alien but not lien
                                 '/bl$/',   // syllable
                                 '/io/',    // biography
                                 )

[line 59]

The special cases of fragments which detect as 1 but should be 2 syllables.

Type:   array


[ Top ]

$silentSyllables = array('/\wely$/',    // absolutely but not ely
                                 '/\wion/',
                                 '/iou/',
                                )

[line 71]

The special cases of fragments which detect as 2 but should be 1 syllables.

Type:   array


[ Top ]

$word =

[line 41]

The word
  • Access: public

Type:   string


[ Top ]

$_numSyllables =  0

[line 50]

The number of syllables. This is internal, the value should be accessed through the accessor.
  • Access: protected

Type:   number


[ Top ]



Method Detail

Text_Word (Constructor)   [line 82]

Text_Word Text_Word( [string $name = ''])

Constructs a word by name.
  • Access: public

Parameters:

string   $name     

[ Top ]

numSyllables   [line 135]

void numSyllables( )

Returns the number of syllables. Caches the value in the object.
  • Access: public

[ Top ]

_countSpecialSyllables   [line 109]

void _countSpecialSyllables( string $scratch)

Helper function, counts syllable exceptions
  • Access: protected

Parameters:

string   $scratch     

[ Top ]

_mungeWord   [line 93]

void _mungeWord( string $scratch)

Helper function, canocalizes the word.
  • Access: protected

Parameters:

string   $scratch     

[ Top ]


Documentation generated on Mon, 08 Feb 2010 14:00:02 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.