Class: Bs_Om_OnomasticsServer
Source Location: /plugins/onomastics/Bs_Om_OnomasticsServer.class.php
Bs_Object
|
--Bs_Om_OnomasticsServer
problems we face: o) typo: simth instead of smith.
Author(s):
Version:
- 4.5.$Revision: 1.3 $ $Date: 2003/11/08 23:16:26 $
Copyright:
|
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Class Methods
constructor Bs_Om_OnomasticsServer [line 218]
Bs_Om_OnomasticsServer Bs_Om_OnomasticsServer(
)
|
|
constructor
method addRelation [line 1173]
bool addRelation(
int
$relationTypeID, int
$first_FirstnameID, int
$second_FirstnameID, [int
$third_FirstnameID = 0])
|
|
adds a relation for firstnames.
Tags:
Parameters:
method calcSimilarityFirstname [line 634]
int calcSimilarityFirstname(
string
$nameOne, string
$nameTwo, [int
$pointsPercent = 100])
|
|
calculates the similarities of two firstnames. examples: calcSimilarityFirstname('john', 'John') => 100 (equal) calcSimilarityFirstname('rené', 'rene') => 98 (equal after normalizing) calcSimilarityFirstname('jürg', 'juerg') => 98 (equal after normalizing) calcSimilarityFirstname('hansjürg', 'hans') => 80 (part of, starts with, ends with) calcSimilarityFirstname('hansjuerg', 'juerg') => 73 (part of, starts with, ends with (after normalizing)) calcSimilarityFirstname('john', 'hans') => 70 some relation exists (short form, translation, ...) calcSimilarityFirstname('william', 'bill') => 70 some relation exists (short form, translation, ...) (string compare)
Tags:
Parameters:
method calcSimilarityFirstnameMultiple [line 951]
void calcSimilarityFirstnameMultiple(
mixed
$nameOne, mixed
$nameTwo)
|
|
method calcSimilarityLastname [line 823]
int calcSimilarityLastname(
string
$nameOne, string
$nameTwo, [int
$pointsPercent = 100])
|
|
Tags:
Parameters:
method calcSimilarityLastnameMultiple [line 993]
void calcSimilarityLastnameMultiple(
mixed
$nameOne, mixed
$nameTwo)
|
|
method cleanLastname [line 311]
string cleanLastname(
string
$lastname)
|
|
cleans the given lastname and returns it. removes all sorts of titles, suffixes, prefixes, qualifiers, ... examples: "von roll" => "roll"
Tags:
Parameters:
method deleteRelation [line 1195]
bool deleteRelation(
int
$relationTypeID, int
$first_FirstnameID, int
$second_FirstnameID)
|
|
removes a relation for firstnames.
Tags:
Parameters:
method findFirstname [line 275]
array findFirstname(
string
$name, [int
$gender = 0], [bool
$strict = FALSE], [bool
$returnData = FALSE])
|
|
finds firstname records for the given $name and $gender. param $returnData: FALSE = return a vector with ID's only. TRUE = return a hash where the key is the ID, the value is a hash with the key/value pairs of the fields.
Tags:
Parameters:
method findRelations [line 1069]
void findRelations(
int
$forID, array
&$relationWordIDs, array
&$relationIDs, array
&$allWordIDs)
|
|
finds the relations for the given word. more details about the params: $forID is the record ID of the word you want. $relationWordIDs is a vector holding hashes with the keys: wordOneID, wordTwoID, relationTypeID $relationIDs is a vector with the record IDs of the relation table. $allWordIDs is a vector with all word record IDs (except the given $forID, i think). yes, we have that data in $relationWordIDs aswell. this is used internally, it's an optimization.
Tags:
Parameters:
method findRelationsLimit [line 1123]
void findRelationsLimit(
mixed
$forID, array
&$relationWordIDs, array
&$relationIDs, array
&$allWordIDs, [int
$limit = 2])
|
|
finds the relations for the given word - and follows the found words to $limit relations. example: $relationWordIDs = array(); $relationIDs = array(); $allWords = array($yourOriginalWordID); $Bs_Om_OnomasticsServer->findRelationsLimit($yourOriginalWordID, $relationWordIDs, $relationIDs, $allWords, 2); //now you could for example fetch details for the names found: while (list($wordID) = each($allWords)) { $sql = "SELECT * from BsOnomastics.Firstname where ID = {$wordID}"; $allWords[$wordID] = $this->_bsDb->getRow($sql); }
Tags:
Parameters:
method getGender [line 421]
int getGender(
string
$firstname, [bool
$strict = FALSE], [bool
$returnPlainText = FALSE])
|
|
returns the gender for the given firstname. returned value: -2 = female -1 = more female - = both
- = more male
- = male
examples: 'richard' => 2 'andrea' => 0 (real female in italy, but mostly male in germany/switzerland/...) 'sam' => 1 (can be both, eg sam as short form for samantha, but it's rather male.) 'sarah' => -2 'ztztzt' => bool FALSE 'john-peter' => 2 'john peter' => 2 'anna peter' => -2 (only the first name is used for the lookup)
Tags:
Parameters:
method getNicknames [line 363]
array getNicknames(
string
$firstname)
|
|
returns the nicknames found for the given firstname.
Tags:
Parameters:
method getTranslations [line 389]
array getTranslations(
string
$firstname, [mixed
$toLang = null], [bool
$strict = FALSE])
|
|
returns the name translations found for the given firstname.
Tags:
Parameters:
method getVariations [line 375]
array getVariations(
string
$firstname)
|
|
returns the name variants found for the given firstname.
Tags:
Parameters:
method isOrderOk [line 545]
int isOrderOk(
string
$firstname, string
$lastname)
|
|
given firstname and lastname, this method tells if the order of those names is ok. maybe the firstname/lastname fields were mixed, and now we have "smith john" instead of "john smith". returned value: - = looks wrong
- = can't tell
- = looks ok
this method uses the firstname database table to come to a result. if the given firstname is found in the firstname table, and the lastname is not, then we return 'looks ok' etc, go figure. now the lastname table is used aswell, altough there are not many records yet.
Tags:
Parameters:
method setDbByDsn [line 248]
bool setDbByDsn(
array
$dsn)
|
|
sets the db object.
Tags:
Parameters:
method setDbByObj [line 233]
void setDbByObj(
object
&$bsDb)
|
|
sets the db object.
Tags:
Parameters:
method translateFirstname [line 609]
mixed translateFirstname(
string
$firstname, string
$fromLang, [string
$toLang = null])
|
|
translates the given firstname from $fromLang to $toLang. if $toLang is not given (or null) then it will be translated to all available languages.
Tags:
Parameters:
|
|