Source for file Gender.php
Documentation is available at Gender.php
* ----------------------------------------------------------------------
* Copyright (c) 2006-2016 Khaled Al-Sham'aa.
* ----------------------------------------------------------------------
* This program is open source product; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
* ----------------------------------------------------------------------
* Class Name: Arabic Gender Guesser
* Original Author(s): Khaled Al-Sham'aa <khaled@ar-php.org>
* Purpose: This class attempts to guess the gender of Arabic names
* ----------------------------------------------------------------------
* This PHP class attempts to guess the gender of Arabic names.
* Arabic nouns are either masculine or feminine. Usually when referring to a male,
* a masculine noun is usually used and when referring to a female, a feminine noun
* is used. In most cases the feminine noun is formed by adding a special characters
* to the end of the masculine noun. Its not just nouns referring to people that
* have gender. Inanimate objects (doors, houses, cars, etc.) is either masculine or
* feminine. Whether an inanimate noun is masculine or feminine is mostly
* include('./I18N/Arabic.php');
* $obj = new I18N_Arabic('Gender');
* if ($obj->isFemale($name) == true) {
* @author Khaled Al-Sham'aa <khaled@ar-php.org>
* @copyright 2006-2016 Khaled Al-Sham'aa
* @license LGPL <http://www.gnu.org/licenses/lgpl.txt>
* @link http://www.ar-php.org
* This PHP class attempts to guess the gender of Arabic names
* @author Khaled Al-Sham'aa <khaled@ar-php.org>
* @copyright 2006-2016 Khaled Al-Sham'aa
* @license LGPL <http://www.gnu.org/licenses/lgpl.txt>
* @link http://www.ar-php.org
* Loads initialize values
public function __construct()
* Check if Arabic word is feminine
* @param string $str Arabic word you would like to check if it is
* @return boolean Return true if input Arabic word is feminine
* @author Khaled Al-Sham'aa <khaled@ar-php.org>
$beforeLast = mb_substr($str, - 2, 1, 'UTF-8');
if ($last == 'ة' || $last == 'ه' || $last == 'ى' || $last == 'ا'
|| ($last == 'ء' && $beforeLast == 'ا')
// الأسماء على وزن إفتعال و إفعال
// List of the most common irregular Arabic female names
|