1 : <?php
2 :
3 : /**
4 : * Dictionaries of Old French and Latin
5 : *
6 : * PHP 5
7 : *
8 : * @category DicFro
9 : * @package Model
10 : * @subpackage Search
11 : * @author Michel Corne <mcorne@yahoo.com>
12 : * @copyright 2008-2010 Michel Corne
13 : * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPLv3)
14 : * @link http://www.micmap.org/dicfro
15 : */
16 :
17 : require_once 'Model/Query/Tcaf.php';
18 :
19 : /**
20 : * Search the Conjugation tables dictionary
21 : *
22 : * @category DicFro
23 : * @package Model
24 : * @subpackage Search
25 : * @author Michel Corne <mcorne@yahoo.com>
26 : * @copyright 2008-2010 Michel Corne
27 : * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPLv3)
28 : */
29 :
30 : class Model_Search_Tcaf
31 : {
32 : /**
33 : * Name of the dictionary
34 : * @var string
35 : */
36 : public $dictionary = 'tcaf';
37 :
38 : /**
39 : * Construtor
40 : *
41 : * @param string $directory the dictionaries directory
42 : * @return void
43 : */
44 : public function __construct($directory)
45 : {
46 3 : $this->directory = $directory;
47 3 : $this->query = new Model_Query_Tcaf($directory);
48 3 : }
49 :
50 : /**
51 : * Searches a word in the dictionary
52 : *
53 : * @param string $word the word to search
54 : * @return array the word details
55 : */
56 : public function searchWord($word)
57 : {
58 2 : $conjugation = $this->query->searchVerbConjugation($word) or
59 1 : $conjugation = $this->query->searchModelConjugation($word);
60 :
61 : return array(
62 2 : $conjugation,
63 2 : $this->query->searchComposedVerbs($word),
64 2 : );
65 : }
|