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