I18N_Arabic

# Class: I18N_Arabic_AutoSummarize

Source Location: /Arabic/AutoSummarize.php

### Class Overview

This PHP class do automatic keyphrase extraction to provide a quick mini-summary for a long Arabic document

#### Author(s):

- Khaled Al-Sham'aa <khaled@ar-php.org>

#### Copyright:

- 2006-2016 Khaled Al-Sham'aa

### Methods

- acceptedWord
- cleanCommon
- doNormalize
- doRateSummarize
- doSummarize
- draftStem
- getMetaKeywords
- highlightRateSummary
- highlightSummary
- loadExtra
- minAcceptedRank
- rankSentences
- rankWords
- summarize

### Class Details

[line 143]
This PHP class do automatic keyphrase extraction to provide a quick mini-summary for a long Arabic document

#### Tags:

author: | Khaled Al-Sham'aa <khaled@ar-php.org>
copyright: | 2006-2016 Khaled Al-Sham'aa
link: | http://www.ar-php.org
license: | LGPL

[ Top ]

### Class Methods

### method acceptedWord [line 668]

`boolean acceptedWord( string $word)`

Check some conditions to know if a given string is a formal valid word or not

#### Tags:

return: | True if passed string is accepted as a valid word else it will return False
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $word | String to be checked if it is a valid word or not

[ Top ]

### method cleanCommon [line 470]

`string cleanCommon( string $str)`

Extracting common Arabic words (roughly) from input Arabic string (document content)

#### Tags:

return: | Arabic document as a string free of common words (roughly)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $str | Input normalized Arabic document as a string

[ Top ]

### method doNormalize [line 448]

`string doNormalize( string $str)`

Normalized Arabic document

#### Tags:

return: | Normalized Arabic document
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $str | Input Arabic document as a string

[ Top ]

### method doRateSummarize [line 317]

`string doRateSummarize( string $str, integer $rate, string $keywords)`

Summarize percentage of the input Arabic string (document content) into output

#### Tags:

return: | Output summary requested
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $str | Input Arabic document as a string
integer | $rate | Rate of output summary sentence number as percentage of the input Arabic string (document content)
string | $keywords | List of keywords higlited by search process

[ Top ]

### method doSummarize [line 296]

`string doSummarize( string $str, integer $int, string $keywords)`

Summarize input Arabic string (document content) into specific number of sentences in the output

#### Tags:

return: | Output summary requested
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $str | Input Arabic document as a string
integer | $int | Number of sentences required in output summary
string | $keywords | List of keywords higlited by search process

[ Top ]

### method draftStem [line 487]

`string draftStem( string $str)`

Remove less significant Arabic letter from given string (document content).

Please note that output will not be human readable.

#### Tags:

return: | Output string after removing less significant Arabic letter (not human readable output)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $str | Input Arabic document as a string

[ Top ]

### method getMetaKeywords [line 383]

`string getMetaKeywords( string $str, integer $int)`

Extract keywords from a given Arabic string (document content)

#### Tags:

return: | List of the keywords extracting from input Arabic string (document content)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $str | Input Arabic document as a string
integer | $int | Number of keywords required to be extracting from input string (document content)

[ Top ]

### method highlightRateSummary [line 363]

`string highlightRateSummary( string $str, integer $rate, string $keywords, string $style)`

Highlight key sentences (summary) as percentage of the input string (document content) using CSS and send the result back as an output.

#### Tags:

return: | Output highlighted key sentences summary (using CSS)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $str | Input Arabic document as a string
integer | $rate | Rate of highlighted key sentences summary number as percentage of the input Arabic string (document content)
string | $keywords | List of keywords higlited by search process
string | $style | Name of the CSS class you would like to apply

[ Top ]

### method highlightSummary [line 340]

`string highlightSummary( string $str, integer $int, string $keywords, string $style)`

Highlight key sentences (summary) of the input string (document content) using CSS and send the result back as an output

#### Tags:

return: | Output highlighted key sentences summary (using CSS)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | public

#### Parameters:

string | $str | Input Arabic document as a string
integer | $int | Number of key sentences required to be highlighted in the input string (document content)
string | $keywords | List of keywords higlited by search process
string | $style | Name of the CSS class you would like to apply

[ Top ]

### method loadExtra [line 184]

`void loadExtra( )`

Load enhanced Arabic stop words list

#### Tags:

access: | public

[ Top ]

### method minAcceptedRank [line 627]

`integer minAcceptedRank( array $str, array $arr, integer $int, integer $max)`

Calculate minimum rank for sentences which will be including in the summary

#### Tags:

return: | Minimum accepted sentence rank (sentences with rank more than this will be listed in the document summary)
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

array | $str | Document sentences
array | $arr | Sentences ranks
integer | $int | Number of sentences you need to include in your summary
integer | $max | Maximum number of characters accepted in your summary

[ Top ]

### method rankSentences [line 546]

`array rankSentences( array $sentences, array $stemmedSentences, array $arr)`

Ranks sentences in a given Arabic string (document content).

#### Tags:

return: | Two dimension array, first item is an array of document sentences, second item is an array of ranks of document sentences.
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

array | $sentences | Sentences of the input Arabic document as an array
array | $stemmedSentences | Stemmed sentences of the input Arabic document as an array
array | $arr | Words ranks array (word as an index and value refer to the word frequency)

[ Top ]

### method rankWords [line 503]

`hash rankWords( string $str)`

Ranks words in a given Arabic string (document content). That rank refers to the frequency of that word appears in that given document.

#### Tags:

return: | Associated array where document words referred by index and those words ranks referred by values of those array items.
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $str | Input Arabic document as a string

[ Top ]

### method summarize [line 205]

`string summarize( string $str, string $keywords, integer $int, string $mode, string $output, [string $style = null])`

Core summarize function that implement required steps in the algorithm

#### Tags:

return: | Output summary requested
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
access: | protected

#### Parameters:

string | $str | Input Arabic document as a string
string | $keywords | List of keywords higlited by search process
integer | $int | Sentences value (see $mode effect also)
string | $mode | Mode of sentences count [number|rate]
string | $output | Output mode [summary|highlight]
string | $style | Name of the CSS class you would like to apply

[ Top ]

Documentation generated on Fri, 01 Jan 2016 10:25:52 +0200 by phpDocumentor 1.4.0